I have the oddest problem when trying to look for empty/null values in a table. For some reason it doesn't pick them up as expected.
The script is suppossed to return the database name if the schema version table is empty, but instead it doesn't return anything. Any ideas?
SELECT @command = 'USE ' +@DB_Name+ '
SELECT '+ ''''+@DB_Name+ '''' +' as DB_Name, version_number
FROM ' +@DB_Name + '.CQ_DBO.schema_version
WHERE version_number = '' '' OR version_number IS NULL'
EXEC sp_executesql @command