1、Row_Number()
select * from (select Row_Number() over (order by FSalary) as 'RowNum' ,* from dbo.T_Employee) a where a.RowNum>= 2 and a.RowNum<= 5
2、Substring() 这个函数接受三个参数,第一个参数为要取的主字符串,第二个参数为字串的起始位置(从1开始计数),第三个参数为字串的长度。
select FName, Len(FName) as namelength from T_Employee where FName is not null; select FName, Substring(FName, 2, 3) from T_Employee where FName is not null;
3、正弦函数SIN 绝对值函数ABS
select FName, FAge, Sin(FAge), Abs(Sin(FAge)) from T_Employee;
4、日期时间转换
select Convert(Varchar(50), GetDate( ), 120) as 当前日期; --2019-04-09 15:28:51 select Convert(Varchar(50), GetDate( ), 23) as 当前日期; --2019-04-09 select Convert(Varchar(50), GetDate( ), 108) as 当前日期; --15:28:51