Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Get column names in a table Expand / Collapse
Author
Message
Posted Saturday, December 4, 2010 11:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: 2 days ago @ 10:27 AM
Points: 9, Visits: 438
Comments posted to this topic are about the item Get column names in a table
Post #1030299
Posted Sunday, December 5, 2010 10:00 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, April 18, 2014 6:34 AM
Points: 88, Visits: 286
Hi To find column in a table you posted a code but it is getting results... Here I am posting the code to get column in the table that is also same it is getting results.... but for this i am getting results for one table... but i need all the tables column names in the DB... Plz give me query for that....



SELECT Column_Name 'Column Name',
Data_type 'Data Type', character_maximum_length 'Maxium Length'
FROM information_schema.columns WHERE table_name = 'Table_Name'


suresh
Post #1030437
Posted Monday, December 6, 2010 6:01 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: 2 days ago @ 10:27 AM
Points: 9, Visits: 438

SELECT Column_Name 'Column Name',table_name 'Table_Name;
Data_type 'Data Type', character_maximum_length 'Maxium Length'
FROM information_schema.columns
GROUP BY table_name
Post #1030548
Posted Monday, December 6, 2010 11:19 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, October 16, 2014 1:56 PM
Points: 283, Visits: 475
Suresh, to get that information for all tables in the database, remove the WHERE clause from the original query.
Post #1030746
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse