Image

Imagegeg_ma3au wrote in Imagesqlserver 😡stressed

Hi, all =)
I'm newbie with the MSSQL, and for today I have one question:
Can I use a variable as an alias to column?
Something like this:

DECLARE @tmp varchar(20)
SET @tmp="Employee Name"
SELECT Table1.NAME AS @tmp FROM Table1

Result:

Msg 102, Level 15, State 1, Line 4
Incorrect syntax near '@tmp'.


Can somebody help me?