zoukankan      html  css  js  c++  java
  • SqlServer 【基 本 操 作】

    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
  • 相关阅读:
    HDU 2602
    ZOJ 1074 最大子矩阵和
    POJ 3903
    最大子段和
    HDU 1052
    CodeForces 18C
    CodeForces 546B-Soldier and Badges
    UVA 11462-Age sort
    Codeforces Round #326 (Div. 2)-Duff in Love
    Codeforces Round #327 (Div. 2)-Wizards' Duel
  • 原文地址:https://www.cnblogs.com/kikyoqiang/p/10647941.html
Copyright © 2011-2022 走看看