Consider the below table "sample_table"
id name desc
-------------------------
1 kkt kkt description
1 skt skt description
is there anyway I can select the third column without using its name desc
?
Trying select desc from mytable
throws an error
Please suggest.
Thanks,
Balan
Does this help:
From http://www.daniweb.com/web-development/databases/ms-sql/threads/341388
I fail to see why you need this and I would never use it myself.
Update
You should do like this instead.
Use
[]
around column names that is reserved words.select mytable.desc from mytable;
work fine for me
Use standard SQL quoted identifiers around column names that are reserved words e.g.
Just so you can go shoot yourself in the foot, here's how you could do it with dynamic sql: