pdlarue
asked on
Want to query for column names in a table or Describe (Not T-SQL, just SQL query)
I have a million tables to look at. I want to get the column names without having to retype them.
DESCRIBE tablename - is giving me an error
SELECT COLUMN_NAME from information_schema WHERE TABLE_NAME = 'tablename' - is giving me an error - Should the information_schema be replaced with the database name or is information_schema a Microsoft provided system schema?
Do I need special privileges?
I'm not using T-SQL, just plain SQL Queries. Can anybody help me find a way to get the column names in a list from the database?
Thank you in advance,
Patricia
DESCRIBE tablename - is giving me an error
SELECT COLUMN_NAME from information_schema WHERE TABLE_NAME = 'tablename' - is giving me an error - Should the information_schema be replaced with the database name or is information_schema a Microsoft provided system schema?
Do I need special privileges?
I'm not using T-SQL, just plain SQL Queries. Can anybody help me find a way to get the column names in a list from the database?
Thank you in advance,
Patricia
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the information_schema gives all the technical implementation, but there is no tool to give you a diagram unless there are primary key + foreign key contraints set up...
ASKER
Thank you, angellll, you have been very helpful. I found the following SQL that gave me a resultset of all tables and their column information. I just had to query each database. This might be helpful to you or others in the future.
SELECT * FROM information_schema.columns
Thanks again,
Patricia
SELECT * FROM information_schema.columns
Thanks again,
Patricia
ASKER
I got it. Thank you. I'll give you the points but can you maybe tell me how to get a data dictionary from
SQL Server? I have 12 databases and nobody has done any documentation on it at all; not even an ER Diagram.
Thank you,
Patricia