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 the use of keyword with encryption. Create a store procedure with encryption?
What is row-level compre?
What is the purpose of the master database?
What is a heap?
What is a full text index?
Do you know what is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting is possible?
What is the purpose of the tempdb database?
How do you know if sql server is running on your local system?
What is a non clustered primary key?
Tell me what is difference between view and materialized view?
What is log shipping? Can we do logshipping with SQL Server 7.0 ?
Define model database?
How to deploy the Report?
What are the types of subquery?
What is dirty page?