How can I get column names from a table in SQL Server? -
I want to query the names of all the columns in a table. I came to know that:
But I must know: How can this be done in Microsoft SQL Server (in my case 2008)?
You can get this information and ask more, by asking more You can.
This sample query:
SELECT * to Northwind.INFORMATION_SCHEMA. COLUMNS WHERE TABLE_NAME = N'Customers' can be made on all these DB objects:
- CHECK_CONSTRAINTS
- COLUMN_DOMAIN_USAGE - COLUMN_PRIVILEGES
COLUMNS
- CONSTRAINT_COLUMN_USAGE
- CONSTRAINT_TABLE_USAGE
- DOMAIN_CONSTRAINTS
- DOMAINS
- KEY_COLUMN_USAGE
- Parameter
- REFERENCIAL_ CONSTRAINTS
- ROUTINES
- ROUTINE_COLUMNS
- SCHEMATA
- TABLE_CONSTRAINTS
- TABLE_PRIVILEGES
- Tables - - VIEW_COLUMN_USAGE
- VIEW_TABLE_USAGE
- VIEWS
Comments
Post a Comment