Q&A for professionals and students of engineering
Select 'Select ''' + ''' As [DatabaseName], Case WHEN TagName IS NULL Then ''' + 'Null' + ''' WHEN TagName = '''' Then ''Empty'' ELSE ''Unexpected'' End As [Type], Count(*) As [Count] from ' + '[' + ']' + '..Tags Where IsNull(TagName,'''')='''' Group By TagName UNION'