• 实用T-SQL代码


    1.根据出生日期计算当前已满周岁

    DECLARE @birth datetime
    SET @birth='1990-01-01'
    SELECT (cast(convert(char( 8 ),GETDATE(),112) as int) - cast(convert(char(8),@birth,112) as int))/10000

    2.COUNT(expression) just returns the total number of rows in which that expression is not null.

    COUNT函数返回值不为null的行数。

    ID FullName
    1 NULL
    2 NULL
    SELECT COUNT(1) FROM t1 -- Returns 2
    SELECT COUNT(FullName) FROM t1 -- Returns 0
    COUNT(expression) just returns the total number of rows in which that expression is not null. - See more at: http://www.sqlteam.com/article/how-to-use-group-by-in-sql-server#sthash.b6O058Mg.dpuf

     (持续更新中)

  • 相关阅读:
    数据结构实验2-迷宫
    离散实验4
    关系代数中的除法运算
    数据库中什么叫象集
    (转)汇编-补码
    2014022201
    20140222
    2014022101
    代码20140221
    代码20140215
  • 原文地址:https://www.cnblogs.com/wsion/p/4253471.html
Copyright © 2020-2023  润新知