随笔分类 -  Sql专题

Sql日期和时间函数用法
摘要:1、DATEADD (datepart ,number,date ) 通过向指定日期添加间隔,返回新的 datetime 值。Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->selectDateadd(m,2,getdate()) 其中可识别的 datepart 选项和缩写:日期部分缩写年份yy、yyyy季度qq、q月份mm、m每年的某一日dy、y日期dd、d星期wk、ww小时hh分钟mi、n秒ss、s毫秒ms2、DATEDIFF ( dat 阅读全文

posted @ 2010-01-06 10:43 junetan 阅读(85) 评论(0) 推荐(0)

Sql用法之游标
摘要:Transact-SQL 游标主要用于存储过程、触发器和 Transact-SQL 脚本中,它们使结果集的内容可用于其他 Transact-SQL 语句。CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->DECLARE@vartextnvarchar(50)declare@rowNumberintset@rowNumber=0DECLARErow_cursorCURSORFORselectjob_descfromjobsOPENrow_ 阅读全文

posted @ 2009-09-11 10:18 junetan 阅读(52) 评论(0) 推荐(0)

Sql用法之Case
摘要:计算条件列表并返回多个可能的结果表达式之一。 CASE 有两种格式: 简单 CASE 函数将某个表达式与一组简单表达式进行比较以确定结果。 CASE 搜索函数计算一组布尔表达式以确定结果。 两种格式均支持可选的 ELSE 参数。语法CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->CASEinput_expressionWHENwhen_expressionTHENresult_expression[n][ELSEelse_result 阅读全文

posted @ 2006-11-09 00:42 junetan 阅读(80) 评论(0) 推荐(0)

导航