22,210
社区成员
发帖
与我相关
我的任务
分享
1.怎么样能让缓存表中的IDENTITY 列重新记录
例如定义@tb中ID,在用WHILE往里INSERT时候每次ID都标识都重新开始
2.有缓存表@tb
ID,Name
1,a
2,b
3,c
要查询显示成
a,b,c
-------------------
1、truncate table 表名
2、declare @sql varchar(1000)
select @sql=isnull(@sql+',','')+Name from @tb
@sql即为a,b,c
2
declare @output varchar(8000)
select @output = coalesce(@output+',', '') + name from table
print @output