how to find number of columns in a table in sql server 2000
and 2005 also
Answer Posted / anand k
--Count of Columns
SELECT COUNT(*) NO_OF_COLUMNS
FROM SYS.COLUMNS
WHERE OBJECT_ID = OBJECT_ID('<TableName>')
ORDER BY Column_ID
--Column Names
SELECT [NAME]
FROM SYS.COLUMNS
WHERE OBJECT_ID = OBJECT_ID('<TableName>')
ORDER BY Column_ID
| Is This Answer Correct ? | 14 Yes | 6 No |
Post New Answer View All Answers
What is server-level principal?
What is difference between rownum and row_number?
Explain the use of containers in ssis?
What is a result set object returned by mssql_query()?
What are the properties of primary key?
How to delete duplicate rows in sql server?
How to create a new schema in a database?
What is the index requirement in SQL Azure?
What are the dmvs? : sql server database administration
What are the differences between ms sql server & oracle?
Explain the microsoft sql server delete command? : SQL Server Architecture
Tell me what is fill factor?
When would you use it?
explain the difference between oracle- sql and sql server sql ? if both are same y we r using 2 sw.s?
what is the difference between delete table and truncate table commands? : Sql server database administration