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

What is read uncmmited?

1010


What happens if null values are involved in bitwise operations?

965


What is the standby server?

908


What is a field name?

913


List the ways in which dynamic sql can be executed?

969


what exactly sql injuction.how to overcome.....

2484


List out the different types of locks available in sql server?

932


Tell me what is the order in which the sql query is executed?

897


Can you please explain the difference between primary keys and foreign keys?

1057


How do I find the sql server version?

956


What are system databases into sql server (2005/2008) : sql server database administration

964


Can You Use Data Mining Models In Ssrs?

139


Does group by sort data?

846


What is difference between rownum and row_number?

910


How to use "begin ... End" statement structures in ms sql server?

957