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

please differentiate between delete and truncate?

987


What are the disadvantages of using the stored procedures?

1094


What is database isolation in sql server? : sql server database administration

1095


how to use DTS package in 2000,2005,2008 in sql server

1828


How many types of schemas are there?

1036


What does this statement do @@rowcount?

962


Can I use sql azure as a backup with log shipping or database mirroring?

156


How to delete database objects with "drop" statements in ms sql server?

1078


What is the template in sql?

972


What are the differences between stored procedure and view in sql server?

1234


Difference between Logical Page and Physical Page in SSRS.

474


What are the export options of ssrs?

173


What are the common performance issues in sql server?

915


What is the purpose of linked server configuration in sql server?

1036


What are the different types of indexes?

1105