随笔分类 -  SQL

摘要:将一种数据类型的表达式显式转换为另一种数据类型的表达式。CAST 和 CONVERT 提供相似的功能。 cast convert CONVERT() 函数是把日期转换为新数据类型的通用函数。 CONVERT() 函数可以用不同的格式显示日期/时间数据。 CONVERT() 函数转换格式。 参考: h 阅读全文
posted @ 2016-07-01 14:41 ETLeung 阅读(535) 评论(0) 推荐(0)
摘要:1 DECLARE @column1 varchar(50) 2 DECLARE My_Cursor CURSOR --定义游标 3 FOR (SELECT column1 FROM #temp1) --查出需要的集合放到游标中 4 OPEN My_Cursor; --打开游标 5 FETCH NEXT FROM My_Cursor into @column1; -... 阅读全文
posted @ 2016-06-03 15:37 ETLeung 阅读(201) 评论(0) 推荐(0)
摘要:--临时表 insert into ##table([column1],S1, S2,S3)VALUES('VALUE','VALUE','VALUE','VALUE') --把原S1, S2,S3列名 作为 star字段的内容,S1, S2,S3的数据放到qty字段中 insert into ta 阅读全文
posted @ 2016-06-02 14:13 ETLeung 阅读(1015) 评论(0) 推荐(0)
摘要:insert into table_A([column],[column],[column]) select column,column,columnfrom table_Bwhere ...order by ... 阅读全文
posted @ 2016-06-02 09:35 ETLeung 阅读(2162) 评论(0) 推荐(0)