Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 Help Members By Posting Answers For Below Questions

Can we call future method from queueable?

1097


Explain Capacity planning to create a database? and how to monitor it?

4244


State a few properties of relational databases?

1181


How to perform key word search in tables?

1003


Define outer join in sql server joins?

990


How to create new tables with "create table" statements in ms sql server?

1108


Explain sql delete command?

1091


What is the minimum recommended amount of ram for sql server 2012 enterprise?

979


What are the different types of join?

1239


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?

1075


What is self join in sql server joins?

1117


What is postgresql server?

1060


What you can do to delete a table without the delete trigger firing?

1012


How can you ensure that the database and sql server based application perform well?

1126


What is change data capture (cdc) feature?

1121