Get column names of a table in comma delimited format

I have seen many times that a few developers like to write SELECT * instead of column names. It’s definitely a bad habit and not the coding standard of-course. Few times I was reverted back saying that the table/view have very few columns and does not really matter if you write the *. Yes it saves the time during development but it kills the performance on production. If you know a few tricks then it is just a click away. I will explain two shortcuts here, choose the one that is most convenient for you but please stop writing SELECT *.

Shortcut 01:

Note: One time setup is required, please follow the screen captures.






Shortcut 02:


Prasad Sahoo

Prasad Sahoo, is an enthusiast of Microsoft technologies in general and a passionate database professional, mainly focusing on SQL Server performance tuning and business intelligence. He has contributed a long time of his career working on SQL Server and other RDBMS. If he is not busy with SQL stuff then he must be watching some Hollywood movies.

2 thoughts on “Get column names of a table in comma delimited format

  • August 31, 2016 at 9:31 am

    Great tip sir ! I will definitely rollout this to all the developers in my organization today. Thanks a lot.


Leave a Reply

%d bloggers like this: