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 are the different types of SSRS reports?
What are truncate options available in sql server? : sql server database administration
what is raid? : Sql server database administration
Can two tables share the same primary key?
What is ems sql management studio? : sql server management studio
Explain the truncate command?
how many clustered indexes can be created on a table? : Sql server database administration
How do I clean up sql server transaction log?
Explain for xml explicit mode?
what kind of lan types do you know? : Sql server database administration
Is it possible to replicate data from sql server to oracle? : sql server replication
how can a database be repaired? : Sql server administration
how you can get the list of largest tables in a database? : Sql server administration
Write a code to select distinct records without using the DISTINCT keyword.
What is bcp? When does it used?