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

--Count of Columns
SELECT COUNT(*) NO_OF_COLUMNS
FROM SYS.COLUMNS
WHERE OBJECT_ID = OBJECT_ID('<TableName>')
ORDER BY Column_ID

--Column Names
SELECT [NAME]
FROM SYS.COLUMNS
WHERE OBJECT_ID = OBJECT_ID('<TableName>')
ORDER BY Column_ID

Is This Answer Correct ?    14 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain Normalization and DE normalization

1160


Can two different columns be merged into single column? Show practically?

1124


What new data source types were added in ssrs 2014?

169


What is sql view?

1118


What is user defined stored procedures?

993


Explain what is analysis service repository?

1050


What is sub-query in sql server? Explain its properties.

1134


What is resultset concur_updatable?

1056


what is hash nonclustered index

1023


What is create command?

1022


How to call a function from a stored procedure in SQL Server ?

1087


How can we remove orphan records from a table?

1031


What command is used to rename the database?

1089


How to list all schemas in a database?

1104


what are user defined datatypes? : Sql server database administration

1016