Reputation: 36682
I want to return a table with columns names which are not defined somewhere else. Under these columns names I want the records to contain data from different sources: a table, a previously declared variable and a const.
What is the right syntax to do so?
i.e. columns names: "fromTable" (=select col1 from MyTable where id=1) , "fromVar" (=@MyVar), "fromConst"(=5).
thanks!
Upvotes: 0
Views: 98
Reputation: 15125
Simply
select <columns>,@myVar as FromVar, '5' as FromConst
from table
Upvotes: 3