日期:2014-05-18 浏览次数:20609 次
declare @s varchar(1000); set @s='col1,col2,col3'; declare @column_count int; set @column_count = LEN(@s)-LEN(REPLACE(@s,',',''))+1; SELECT id,name FROM sysobjects AS o WHERE EXISTS(SELECT 1 FROM syscolumns WHERE o.id=id AND CHARINDEX(','+name+',',','+@s+',')>0 GROUP BY id HAVING COUNT(*)=@column_count);
------解决方案--------------------