标签:style class blog code ext color
--查询所有列 select name from syscolumns where id=OBJECT_ID(‘PTS_ProjectTask‘) --列转为行 GetColumnJoin ‘ProjectTask‘ alter proc GetColumnJoin @TableName nvarchar(50) as begin declare @tempStr nvarchar(50),@ResultStr nvarchar(max) set @tempStr=‘‘ set @ResultStr=‘‘ declare Columns_Cursor cursor for select name from syscolumns where id=OBJECT_ID(@TableName) open Columns_Cursor fetch next from Columns_Cursor into @tempStr while(@@FETCH_STATUS=0) begin set @ResultStr=@ResultStr+‘,‘+@tempStr fetch next from Columns_Cursor into @tempStr end print @ResultStr close Columns_Cursor deAllocate Columns_Cursor end
标签:style class blog code ext color
原文地址:http://www.cnblogs.com/kedarui/p/3795203.html