Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: Monday, July 4, 2016 7:54 PM
Points: 9, Visits: 448
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: Monday, July 4, 2016 7:54 PM
Points: 9, Visits: 448

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, September 22, 2016 4:05 PM
Points: 289, Visits: 531
Suresh, to get that information for all tables in the database, remove the WHERE clause from the original query.


Phil Helmer
Database Engineer
Post #1030746
Posted Tuesday, May 17, 2016 12:46 PM
SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: 2 days ago @ 7:11 AM
Points: 8,298, Visits: 852
Thanks for the script.
Post #1787017
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse