Is it possible to use the SUBSTRING function in SQL to output the result as Column Name?
Example:
DECLARE @itemname VARCHAR(50) = 'HELLO WORLD'
SELECT SUBSTRING(@itemname, 1, 5) AS OUTPUT
Gives the output as
OUTPUT
-----
HELLO
What I want to achieve here is that the Col name should instead be given out as HELLO
DECLARE @itemname VARCHAR(50) = 'HELLO WORLD'
SELECT col1 AS SUBSTRING(@itemname, 1, 5)
FROM myTable
Which should display
HELLO
------
Record 1
Record 2
Record 3
Record 4
.
.
.