Hi How can I get the name of all columns of a table in SQL SERVER 2008?
Thank you
Hi How can I get the name of all columns of a table in SQL SERVER 2008?
Thank you
You can obtain this information and much, much more by querying the Information Schema views.
Hi
You can use the stored procedure sp_columns which would return information pertaining to all columns for a given table. More info can be found here http://msdn.microsoft.com/en-us/library/ms176077.aspx
You can also do it by a SQL query. Some thing like this should help -
SELECT * FROM sys.columns WHERE object_id = OBJECT_ID('dbo.yourTableName')
I hope this helps.
cheers
by using this query you get the answer select Column_nmae from from Information_schema.columns where Table_name like 'table name'