zoukankan      html  css  js  c++  java
  • 实用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

     (持续更新中)

  • 相关阅读:
    java入门了解14
    java入门了解13
    java入门了解12
    java入门了解11
    Hive-安装
    Hive-基本概念
    Java笔记20
    Java-笔记19
    Java-笔记18-复习
    Java-笔记18
  • 原文地址:https://www.cnblogs.com/wsion/p/4253471.html
Copyright © 2011-2022 走看看