check if query is empty sql server code example Example: sql if empty then SELECT COALESCE(NULLIF(SomeColumn,''), ReplacementColumn) FROM SomeTable