how to find number of columns in a table in sql server 2000
and 2005 also
Answer Posted / anand k
--FOR Given Table Name.
SELECT COUNT(*) FROM SYS.COLUMNS
WHERE ID = OBJECT_ID('<TABLENAME>')
--For All UD Tables in the current DB
SELECT OBJ.NAME,COUNT(*)
FROM SYS.COLUMNS COL,SYS.OBJECTS OBJ
WHERE OBJ.OBJECT_iD = COL.OBJECT_ID
AND TYPE = 'U'
GROUP BY OBJ.NAME
| Is This Answer Correct ? | 4 Yes | 4 No |
Post New Answer View All Answers
please differentiate between delete and truncate?
What are the disadvantages of using the stored procedures?
What is database isolation in sql server? : sql server database administration
how to use DTS package in 2000,2005,2008 in sql server
How many types of schemas are there?
What does this statement do @@rowcount?
Can I use sql azure as a backup with log shipping or database mirroring?
How to delete database objects with "drop" statements in ms sql server?
What is the template in sql?
What are the differences between stored procedure and view in sql server?
Difference between Logical Page and Physical Page in SSRS.
What are the export options of ssrs?
What are the common performance issues in sql server?
What is the purpose of linked server configuration in sql server?
What are the different types of indexes?