I am not sure how to do this but I have a query that has unions in it. and i want to be able to diff each one by added a column. How do I add this column and give it a value. Thanks!
Select ID,Name,SpecialColumn = 'Test'
from table where ID = 'guid';
Use the string literal followed by a column alias
'Test' AS SpecialColumn. This will produce the same value for all rows returned, useful for differentiating betweenUNIONcomponents, or filling out mismatched column numbers betweenUNIONcomponents when necessary.Output (ignoring your where clause) would be something like: