SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


««12345»»»

trying to return all tables except the system talbes from a given database Expand / Collapse
Author
Message
Posted Tuesday, February 09, 2010 12:00 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, March 19, 2010 3:32 PM
Points: 170, Visits: 236
Comment removed by the editor.
Post #862649
Posted Tuesday, February 09, 2010 12:15 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 1:03 PM
Points: 1,679, Visits: 2,067
select * 
from sys.tables
where is_ms_shipped = 0



Wayne
For better assistance in answering your questions, click here.
For performance problems, please read this.
For common date/time routines, click here.
For CROSS-TABS and PIVOT tables, click on Part 1 and Part 2.
Post #862661
Posted Tuesday, February 09, 2010 12:19 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, March 19, 2010 3:32 PM
Points: 170, Visits: 236
WayneS that's actually how i initially implimented it. However it did not work in all instances. unfortunatly. I'm going to triple check and get back to you. Attached kinda gives u a better idea into the issue w/ a little background as to what the purpose is for.

  Post Attachments 
example.doc (14 views, 110.00 KB)
Post #862664
Posted Tuesday, February 09, 2010 12:25 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 9:15 PM
Points: 1,808, Visits: 5,490
use powershell

sqlps dir SQLSERVER:\SQL\<server>\<instance>\Databases\<dbname>\Tables


gives you only user tables, add -force if you want everything.



Post #862670
Posted Tuesday, February 09, 2010 12:32 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, March 19, 2010 3:32 PM
Points: 170, Visits: 236
dont think that will work because they actually of table type "user"
Post #862674
Posted Tuesday, February 09, 2010 12:43 PM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, March 19, 2010 2:31 PM
Points: 649, Visits: 2,089
There are some extended properties that tell you wether the tables were created for schema-modeling.

Here's what I quickly came up with, someone can tune this:

SELECT  name
FROM sys.tables t
WHERE t.is_ms_shipped = 0
AND object_ID NOT IN ( SELECT major_ID
FROM sys.extended_properties
WHERE minor_id = 0
AND minor_id = 0
AND class = 1
AND name = N'microsoft_database_tools_support' )



Cheers,

J-F
Post #862680
Posted Tuesday, February 09, 2010 12:50 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 12:22 AM
Points: 11,937, Visits: 12,053
BaldingLoopMan (2/9/2010)
Comment removed by request.


I'm sorry, but this comment was totally unnecessary as well as unprofessional.

Personally, I think you owe Roy and the SSC community an apology.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #862682
Posted Tuesday, February 09, 2010 12:59 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, March 19, 2010 3:32 PM
Points: 170, Visits: 236
i suppose everyone is entitled to their own opinion.
Post #862685
Posted Tuesday, February 09, 2010 1:11 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 12:22 AM
Points: 11,937, Visits: 12,053
BaldingLoopMan (2/9/2010)
i suppose everyone is entitled to their own opinion.


You're right, we are. And we also can decide who we will help and who we won't.

Bye.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #862691
Posted Tuesday, February 09, 2010 1:11 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, March 19, 2010 3:32 PM
Points: 170, Visits: 236
=====================================================================

SELECT name
FROM sys.tables t
WHERE t.is_ms_shipped = 0
AND object_ID NOT IN ( SELECT major_ID
FROM sys.extended_properties
WHERE minor_id = 0
AND minor_id = 0
AND class = 1
AND name = N'microsoft_database_tools_support' )
======================================================================

i thought i finally stumped the sql server central gurus.

However it appears "J-F Bergeron" has come up w/ the solution. Not exactly sure yet how yet however, it appears to be returning the proper tables so far. Nice work. It appears i have some more learning to do in refference to extended properties and what all it offers.

Excellent work J-F Bergeron!!!!!


Post #862692
« Prev Topic | Next Topic »

««12345»»»

Permissions Expand / Collapse