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

Explain what stored procedure sp_replcounters is used for? : sql server replication

1518


what information is maintained within the msdb database? : Sql server administration

976


Can we insert data if clustered index is disabled?

943


How to call stored procedure using http soap?

1079


What is difference between rollback immediate and with no_wait during alter database?

1092


What is the purpose of floor function?

1039


How to recover from sql injection? : sql server security

1018


what stored procedure can you use to display the current processes? : Sql server administration

1010


What are the differences between char and nchar in ms sql server?

1087


Does windows server 2016 come with sql server?

938


What is for xml in sql server?

1076


Which are the new data types introduced in sql server 2008?

881


optimization techinques

2680


What do you mean by the term 'normalization'?

1209


How does recursive cte works in sql server?

1016