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 are parameterized reports? What are cascading parameters in ssrs reports?
Describe the functionalities that views support.
How to find tables without indexes?
Differentiate between truncate vs delete in mssql?
What happens if null values are involved in string operations?
Is null vs coalesce?
How to change the data type of an existing column with "alter table" statements in ms sql server?
What is the default sql server instance name?
What is default constraint in ms sql server?
How to find a value in another dataset based on current dataset field (ssrs 2008 r2)?
Distinguish between commit and rollback?
What is isolation levels?
Can you explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?
What are character string data types in ms sql server?
How do you create an execution plan?