SELECT *FROM table_name WHERE column_name IS NOT NULL
SELECT fields FROM table_name WHERE column_name IS NOT NULL
SELECT Col1, Col2, Col3 FROM TableName WHERE COALESCE(Col1, Col2, Col3) IS NOT NULL
DECLARE @SqlString VARCHAR(1000), @TableName VARCHAR(100) SELECT @TableName='Table_Name' -- If you need to compare only last 200 columns (20 to 220) then add WHERE condition SELECT @SqlString=COALESCE(@SqlString+',','')+Name FROM syscolumns WHERE OBJECT_NAME(ID)=@TableName AND colorder BETWEEN 20 AND 220 SELECT @SqlString='SELECT COALESCE('+@SqlString+') FROM '+@TableName PRINT @SqlString EXEC(@SqlString)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)