摘要:
declare @s varchar(500),@sql varchar(4000)select @s=isnull(@s+',','')+name from sys.columns where object_id = object_id('表名','U') and name !='字段名' 阅读全文
摘要:
按照,或者特定的字符进行分割,把值取出来,举个例子,数据是: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' 阅读全文