Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 getting user table names from the database

Author  Topic 

Nagesh
Starting Member

1 Post

Posted - 2003-10-20 : 03:00:42
Hi,
Can someone help me in getting the user tables and views from a databse using t-sql or is there any stored procedure...

Bye

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-10-20 : 03:08:48
Look up the Informatio schema views in the Books Online. They can provide a lot of information on tables, views, columns and procedures in the database.

SELECT * FROM INFORMATION_SCHEMA.Tables

the above query returns all tables and views in the database.

Owais



Make it idiot proof and someone will make a better idiot
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-10-20 : 03:12:16
SELECT * FROM INFORMATION_SCHEMA.Tables

SELECT * FROM INFORMATION_SCHEMA.Views



Damian
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-10-20 : 03:12:50
Dammit.
Got distracted by work and Owais got in first


Damian
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-10-20 : 05:08:54
sniped!

Curiously, SELECT * FROM INFORMATION_SCHEMA.Tables returns all Views as well.

Owais


Make it idiot proof and someone will make a better idiot
Go to Top of Page
   

- Advertisement -