摘要: 这里整理日常会用到的一些写法,一些常规的group by,系统函数等用法不在这里做记录了,大家有什么好的写法也可以分享下 1 sql操作xml内容(sp_xml_preparedocument和openxml) 2 sql递归查询(with cte as) 3 sql把查询结果转换成xml格式(fo 阅读全文
posted @ 2015-03-30 17:24 忧忧夏天 阅读(490) 评论(0) 推荐(0) 编辑
摘要: 演示脚本IF not exists(SELECT 1 from sys.sysobjects where name = 'Student' AND type = 'U')BEGIN CREATE table Student( ID int ... 阅读全文
posted @ 2015-03-30 16:10 忧忧夏天 阅读(1097) 评论(0) 推荐(0) 编辑
摘要: 需求:把字符串1,2,3变成表里的行数据方法:用自定义函数实现/* 获取字符串数组的 Table*/if exists (select 1 from sysobjects where id = object_id('Get_StrArrayStrOfTable' )) drop Fu... 阅读全文
posted @ 2015-03-30 13:13 忧忧夏天 阅读(3906) 评论(0) 推荐(0) 编辑
摘要: 需求:获取字符数组1,2,3的第2个元素方法:通过自定义函数来实现/* 获取字符串数组某个元素*/if exists (select 1 from sysobjects where id = object_id('Get_StrArrayStrOfIndex' )) drop Fun... 阅读全文
posted @ 2015-03-30 13:08 忧忧夏天 阅读(6085) 评论(0) 推荐(0) 编辑
摘要: 需求:获取字符串数组1,2,3,4的长度,当然也可以是其他分隔符1|2|3等方法:通过自定义函数来实现/* 获取字符串数组长度*/if exists (select 1 from sysobjects where id = object_id('Get_StrArrayLength' )... 阅读全文
posted @ 2015-03-30 13:03 忧忧夏天 阅读(8590) 评论(0) 推荐(0) 编辑