Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Dynamic SELECT column names

$
0
0

This query works:-

Select col_ID,col_Name as Name from TableName

But; I want the part after AS (coloumn name) dynamic:-

Select col_ID,col_Name as (Select tl_name from Table2 where tl_col_Name='col_Name') from TableName

The highlighted part throws error. 



Viewing all articles
Browse latest Browse all 23857

Trending Articles