parabellum
asked on
Access a database and get table names
Hello,
I need to modify my client's database(he is using SQL Server 2005). I have the connection string so that i can connect to the database.
Is there a way that i can learn the table names that the database has and even the data types that the tables contain ?
Or do i have to ask my client to tell me the table names and the column types/names ?
It would make my life a lot easier if there was a sql query that will retrieve table information from a database.
I need to modify my client's database(he is using SQL Server 2005). I have the connection string so that i can connect to the database.
Is there a way that i can learn the table names that the database has and even the data types that the tables contain ?
Or do i have to ask my client to tell me the table names and the column types/names ?
It would make my life a lot easier if there was a sql query that will retrieve table information from a database.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT TABLE_CATALOG,TABLE_SCHEMA ,TABLE_NAM E,COLUMN_N AME,DATA_T YPE,ORDINA L_POSITION ,COLLATION _NAME,IS_N ULLABLE
FROM information_schema.columns
FROM information_schema.columns
GO
--To get the Table names
select * from sysobjects
where xtype ='U'
--To get the Column names
select * from information_schema.columns
Where table_name like ''