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

What are parameterized reports? What are cascading parameters in ssrs reports?

148


Describe the functionalities that views support.

1049


How to find tables without indexes?

1027


Differentiate between truncate vs delete in mssql?

993


What happens if null values are involved in string operations?

919


Is null vs coalesce?

815


How to change the data type of an existing column with "alter table" statements in ms sql server?

929


What is the default sql server instance name?

968


What is default constraint in ms sql server?

965


How to find a value in another dataset based on current dataset field (ssrs 2008 r2)?

161


Distinguish between commit and rollback?

898


What is isolation levels?

958


Can you explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?

932


What are character string data types in ms sql server?

1138


How do you create an execution plan?

885