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
What is not null constraint?
What is sql service broker?
Explain the truncate command?
How do I open port 1433?
What is thr feature of change data capture?
What is left outer join in sql server joins?
how many no of arguments can be passed in procedures and functions
What is the distinction amongst delete and truncate?
How to add an address record into adventureworkslt?
What is Sqlpaging in SqlServer 2005 ?
Why use view instead of a table?
define and explain the differences between clustered and non-clustered indexes.
What stored by the tempdb ? : sql server database administration
What is dynamic cursor in SQL SERVER?
How does index makes search faster?