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 different types of constraints? : Sql server database administration

947


Do you know what are various aggregate functions that are available?

1109


What are the five characteristics of good data?

908


What languages bi uses to achieve the goal?

996


What is db stored procedure?

874


What is an indice?

1022


How to divide query output into multiple groups with the group by clause in ms sql server?

1023


What is self contained multi valued query?

1006


Explain forward - only cursors?

1049


What is side by side migration in sql server?

1091


What are logical database components? : SQL Server Architecture

1025


What are sql servers used for?

1037


What is the maximum row of a size?

1010


How to create a large table with random data for index testing in ms sql server?

1021


How to Update from select query in sql server?

1050