By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,034 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Select all tables in a database

P: 26
hi to all


i am sridhar


My question is:

To select all tables in a database is

select name from sysobjects where type='U'

But want to mension the database name in the query itself


select .............. where database = 'mydatabas'"

i need query for this


thanks
Jun 14 '07 #1
Share this Question
Share on Google+
1 Reply


Purple
Expert 100+
P: 404
Hi,

how about

Expand|Select|Wrap|Line Numbers
  1. SELECT     name AS Expr1, xtype AS Expr2
  2. FROM         mydatabas.dbo.sysobjects
  3. WHERE     (xtype = 'U')
xtype of 'S' if you want system tables

dbo is the owner

Purple
Jun 14 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.