One of the most popular question I receive is usually about How to get column names from a specific table in SQL Server?
I have previously written about this subject on this blog post: SQL Server – How to Get Column Names From a Specific Table? Please click the blog post and you can also get the scripts which I have listed in the following video.
There are four different methods I have listed in the blog posts. However, I prefer the method 2 the most as the result set is what exactly we need as well as we have complete control of the WHERE clause so we can create our own filter.
I also do not prefer to use the method 3 as it requires us to know the name of the schema before we execute the script. Additionally, please note that it is very difficult to process the result which is retrieved with the method 3.
Please click here to visit the blog post which I have written earlier containing the T-SQL scripts displayed in the video.
Additionally, I want to thank Madhiavanan who gave me an idea of method 3 and 4.
Do let me know if you have any other suggestion for me to create a video.
Reference: Pinal Dave (https://blog.sqlauthority.com)
Thanks Pinal for sharing another nice article.
This post is very help full me.