We all know that to select all columns from a table, we can use
SELECT * FROM tableA
Is there a way to exclude column(s) from a table witho
That what I use often for this case:
declare @colnames varchar(max)='' select @colnames=@colnames+','+name from syscolumns where object_id(tablename)=id and name not in (column3,column4) SET @colnames=RIGHT(@colnames,LEN(@colnames)-1)
@colnames looks like column1,column2,column5
@colnames
column1,column2,column5