Results 1 to 1 of 1
-
03-02-2011, 05:08 PM #1
- Join Date
- Apr 2008
- Location
- Boston, USA
- Posts
- 13,175
- Thanks
- 744
- Thanked 699 Times in 550 Posts
- Blog Entries
- 4
- Feedback Score
- 4 (100%)
Get Column Names of Table - Microsoft Sql
Get Column Names of Table - Microsoft Sql
This is how you can get the name of the columns from a table in MS SQL.
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'TableName'
And if you want them as a comma separated list:
declare @list varchar(max)
select @list=COALESCE(@list+', ','')+COLUMN_NAME
FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'TableName'
select @listFree Classified Ads & BUSINESS/PROFESSIONAL SOCIAL NETWORK
Similar Threads
-
Domain Names - Buy, Sell and Register Australian Domain Names
By michaelchnya in forum Domain NamesReplies: 1Last Post: 08-02-2011, 06:50 AM -
[WTS] Baby Names Database - Meaning and Origin of 41,552 Baby Names (Boys and Girls)
By immediate in forum ContentsReplies: 0Last Post: 02-18-2011, 08:25 AM -
Cannot find either column dbo or the user-defined function or aggregate or the name is ambiguous - Microsoft SQL
By manik in forum DatabasesReplies: 0Last Post: 01-26-2011, 01:24 PM -
how do the copy one table to another table??
By ursimrankhanna in forum DatabasesReplies: 3Last Post: 12-10-2010, 01:24 AM -
Alter Table Column as Identity - MS SQL
By manik in forum DatabasesReplies: 1Last Post: 10-21-2010, 03:46 AM


Reply With Quote

