Q&A for programmers
declare @MyTable table ( ID int, A char(1), B char(1), C char(1), D char(1) ) insert into @MyTable values (6, '1', '2', '', null) ;with C(TableXML) as ( select * from @MyTable where ID = 6 for xml path('T'), elements xsinil, type ) select distinct T.X.value('local-name(.)', 'sysname') as ColumnName from C cross apply C.TableXML.nodes('/T/*') as T(X) where T.X.value('.', 'varchar(max)') <> ''
Error: looks like you typed in the wrong words - try again