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
Can we call future method from queueable?
Explain Capacity planning to create a database? and how to monitor it?
State a few properties of relational databases?
How to perform key word search in tables?
Define outer join in sql server joins?
How to create new tables with "create table" statements in ms sql server?
Explain sql delete command?
What is the minimum recommended amount of ram for sql server 2012 enterprise?
What are the different types of join?
How can you transfer data from a text file to a database table? Or how can you export data from a table to a comma delimited (csv) file? Or how can you import data from ms access to a table in a database? Or how can you export data from a table to an excel file?
What is self join in sql server joins?
What is postgresql server?
What you can do to delete a table without the delete trigger firing?
How can you ensure that the database and sql server based application perform well?
What is change data capture (cdc) feature?