SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 select query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

21 Posts

Posted - 07/02/2014 :  10:46:49  Show Profile  Reply with Quote
HI All

I have a table contains 40 columns , but I want only the columns names only ...
How can I select ?

Flowing Fount of Yak Knowledge

8764 Posts

Posted - 07/02/2014 :  10:53:28  Show Profile  Visit webfred's Homepage  Reply with Quote
see tara's select here:


Too old to Rock'n'Roll too young to die.
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3588 Posts

Posted - 07/02/2014 :  12:49:58  Show Profile  Reply with Quote
An alternative is to query sys.columns
SELECT * FROM sys.columns WHERE OBJECT_NAME(object_id) = 'YourTableNameHere' ORDER BY column_id;
There is a case to be made for using sys.columns instead of INFORMATION_SCHEMA, unless you have a requirement to be ANSI compliant, e.g. http://sqlblog.com/blogs/aaron_bertrand/archive/2011/11/03/the-case-against-information-schema-views.aspx
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000