摘要: declare @s varchar(500),@sql varchar(4000)select @s=isnull(@s+',','')+name from sys.columns where object_id = object_id('表名','U') and name !='字段名' 阅读全文
posted @ 2012-12-21 15:57 山清石玉 阅读(374) 评论(0) 推荐(0) 编辑
摘要: 按照,或者特定的字符进行分割,把值取出来,举个例子,数据是:a,b,cd,e,f显示结果是:abcdef解决方法:拆分表:ifnotobject_id('Tab')isnulldroptableTab Go CreatetableTab([Col1]int,[COl2]nvarchar(5)) InsertTab select1,N'a,b,c'unionallselect2,N'd,e'unionallselect3,N'f'Go --SQL2000用辅助表: ifobject_id('Tempdb..#Num' 阅读全文
posted @ 2012-12-21 15:26 山清石玉 阅读(267) 评论(0) 推荐(0) 编辑