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 coalesce and check constraint in sql server?
What are the built in functions in sql server?
How can we improve performance by using SQL Server profiler?
How to define output parameters in stored procedures?
Do you know the capabilities of cursors?
What is the difference between ddl and dml?
How do I view a script in sql server?
What is read uncmmited?
What is the difference between push and pull subscription? : sql server replication
How can we delete a table in sql server?
How to get a list of columns in a view using the "sp_columns" stored procedure?
What is the meaning of sql server?
Show Practically Sql Server Views are updatable?
How many servers can we create in a single subscription?
What is the optimal disk configuration for a database server and what raid configurations would you use if budget is not a constraint?