Hi,I'm trying to generate a list tablenames and the columns in the table without using a cursor.declare @cols varchar (4000)declare @table varchar (255)set @table = 'USERS'Select @cols = COALESCE(@cols +',','')+ c.name from sys.columns c , sys.objects owhere o.type = 'U' and c.object_id = o.object_idand o.name = @tableorder by o.name, column_idSelect @table,@cols
I get the results i want and in the proper format, but for only one table.Is there a way to make it dynamic enough to return all of the user tables and thier column names(comma separated) in different rows, without using a cursor.i.e.col001 | col002users | userid,usernameproducts | productid,userid,productnameThanksStephenThanks