List all tables in Database

deepthiv

Registered User.
Local time
Today, 09:57
Joined
Oct 18, 2005
Messages
11
hi,

can anyone please tell wht's the query to check if database exists, if exists list all tables in database (in sqlserver) else raise error

Thanks in advance,
Deepthi
 
Deep,

For SQL Server, this gives you all databases:

Select Name from master..Sysdatabases order by name

Then, this will give you all tables:

Select Name From SomeDatabase..SysObjects Where Type = 'U'

Wayne
 
Thanks a lot Ryan..

It helped me
 

Users who are viewing this thread

Back
Top Bottom