06 2013 档案

摘要:drop table #tempcreate table #temp (id int) declare @a int declare @b varchar(50)set @a=1while(@a 0)begininsert into @table values(substring(@str,1,charindex(@split,@str) - 1))set @str = stuff(@str,1,charindex(@split,@str),'')endinsert into @table values(@str)end--1. 创建处理函数create table tb(id 阅读全文
posted @ 2013-06-26 18:26 longdexinoy 阅读(395) 评论(0) 推荐(0) 编辑
摘要:合并列值表结构,数据如下:view plainid value ----- ------ 1 aa 1 bb 2 aaa 2 bbb 2 ccc 需要得到结果: id values ------ ----------- 1 aa,bb 2 aaa,bbb,ccc 即:group by id, 求 value 的和(字符串相加)1. 旧的解决方法(在sql server 2000中只能用函数解决。) --1. 创建处理函数 create table tb(id int, value varchar(10)) insert into tb values(1, 'aa') inser 阅读全文
posted @ 2013-06-26 18:19 longdexinoy 阅读(355) 评论(0) 推荐(0) 编辑