Skip to main content

To get List of Column names by giving table Names

Hi, here I will Query you how to get the list of column names by passing the table name as input. There are two methods to get the output. First Query gives better performance than Second Query.


Method 1 :

SELECT
           sc.Name [Field Name]
     FROM
           SYSCOLUMNS sc
           inner join SYSOBJECTS so ON
           so.id = sc.id
     WHERE
           so.name = @tablename


Method 2 :

SELECT name FROM SYS.COLUMNS
     WHERE OBJECT_NAME(OBJECT_ID) = @tablename
     ORDER BY column_id  



Comments


  1. It's very useful article with inforamtive and insightful content and i had good experience with this information. We, at the CRS info solutions ,help candidates in acquiring certificates, master interview questions, and prepare brilliant resumes.Go through some helpful and rich content Salesforce Admin syllabus from learn in real time team. This Salesforce Development syllabus is 100% practical and highly worth reading. Recently i have gone through Salesforce Development syllabus and Salesforce Admin syllabus which includes Salesforce training in USA so practically designed.

    ReplyDelete
  2. Such a very useful article. Very interesting to read this article. I would like to thank you for the efforts you had made for writing this awesome article.
    Data Science Course in Pune
    Data Science Training in Pune

    ReplyDelete
  3. Thumbs up guys your doing a really good job. It is the intent to provide valuable information and best practices, including an understanding of the regulatory process.
    Cyber Security Course in Bangalore

    ReplyDelete
  4. Very nice blog and articles. I am really very happy to visit your blog. Now I am found which I actually want. I check your blog everyday and try to learn something from your blog. Thank you and waiting for your new post.
    Cyber Security Training in Bangalore

    ReplyDelete
  5. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. Keep posting. Thanks for sharing.
    Data Science Training Institute in Bangalore

    ReplyDelete
  6. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
    Best Data Science Courses in Bangalore

    ReplyDelete
  7. After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article.
    Ethical Hacking Course in Bangalore

    ReplyDelete
  8. Wow! Such an amazing and helpful post this is. I really really love it. I hope that you continue to do your work like this in the future also.
    Ethical Hacking Training in Bangalore

    ReplyDelete
  9. With so many books and articles coming up to give gateway to make-money-online field and confusing reader even more on the actual way of earning money,
    Data Science Course in Bangalore

    ReplyDelete
  10. I found Hubwit as a transparent site, a social hub which is a conglomerate of Buyers and Sellers who are ready to offer online digital consultancy at decent cost.
    Data Science Training in Bangalore

    ReplyDelete
  11. I am impressed by the information that you have on this blog. Thanks for Sharing
    Ethical Hacking in Bangalore

    ReplyDelete
  12. I see the greatest contents on your blog and I extremely love reading them.

    Data Science Course

    ReplyDelete
  13. I want to post a remark that "The substance of your post is amazing" Great work.

    Data Science Training

    ReplyDelete
  14. Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It's really very nice and Useful post.Thanks..

    Data Science Courses

    ReplyDelete
  15. The web site is lovingly serviced and saved as much as date. So it should be, thanks for sharing this with us.

    Data Science Certification

    ReplyDelete

Post a Comment