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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to get the list of master tables in a database
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mohan123
Constraint Violating Yak Guru

India
252 Posts

Posted - 01/23/2013 :  04:59:53  Show Profile  Reply with Quote
Hello all,

How i can get the list of master tables in databse. here i need only master tables not transaction tables or child tables...

suggest me

P.V.P.MOhan

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 01/23/2013 :  05:32:56  Show Profile  Reply with Quote
Didn't quite get what you meant by master tables, transaction tables, child tables etc.
All of these will give you information about base user tables:

INFORMATION_SCHEMA.TABLES
sys.tables
sys.objects where [type] = 'U'
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 01/23/2013 :  07:13:43  Show Profile  Reply with Quote
quote:
Originally posted by mohan123

Hello all,

How i can get the list of master tables in databse. here i need only master tables not transaction tables or child tables...

suggest me

P.V.P.MOhan


probably you meant system tables

SELECT *
FROM sys.objects
WHERE type='u'
AND is_ms_shipped=1


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2241 Posts

Posted - 01/23/2013 :  08:08:25  Show Profile  Reply with Quote
Run this procedure to get all parent table names( take only the tablenames which has oSequence as 1)

EXEC sp_msdependencies @intrans = 1

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 01/23/2013 :  11:00:23  Show Profile  Reply with Quote
quote:
Originally posted by bandi

Run this procedure to get all parent table names( take only the tablenames which has oSequence as 1)

EXEC sp_msdependencies @intrans = 1

--
Chandu


Using undocumented features can have undesirable effects as its implementation may change without notice. Its not safe to use this on production environment.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000