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
Why people hate cursor?
How to start sql server browser service?
List the different types of collation sensitivities in sql server?
What is the importance of concurrency control?
What are the commands used in DCL?
What is resultset concur_updatable?
You have developed an application which uses many stored procedures and triggers to update various tables users ocassionally get locking problems which tool is best suited to help you diagnose the problem?
You notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it?
What is a natural primary key?
why would you call update statistics? : Sql server database administration
What is sql stored procedure?
Which data type columns are the best candidates for full-text indexing?
what is datawarehouse?
What is sql server used for?
What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?