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


Add to briefcase «««23456

Undocumented Extended and Stored Procedures Expand / Collapse
Author
Message
Posted Wednesday, January 6, 2010 11:02 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, February 6, 2014 12:59 PM
Points: 801, Visits: 1,962
You are going to just love this one! Try it like this:
exec dbo.sp_msforeachtable 'select * from ?'

Note the lack of brackets. Go figure.


ATB

Charles Kincaid

Post #843031
Posted Tuesday, January 12, 2010 7:14 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Friday, April 4, 2014 4:40 PM
Points: 751, Visits: 917
m.ciesiensky (1/6/2010)
Timothy,
when attempting to run sp_msforeachtable in each of the variations below, I get these errors. I have tried running from both the master and CBL databases, with all same results.
Any Ideas?

exec dbo.sp_msforeachtable 'select * from CBL.dbo.[?]'

Msg 208, Level 16, State 1, Line 1
Invalid object name 'CBL.dbo.[dbo].[ae_amap]'.



Any help from anyone will be much appreciated.


The ? in sp_msforeachtable includes the schema already and is already quoted. In other words, remove the dbo. and the brackets and it should work. Something like:

exec sp_msforeachtable 'select * from ?'

if you are doing it inside CBL or

exec sp_msforeachtable 'select * from CBL.?'

if you want or need to fully qualify it.


---
Timothy A Wiseman
SQL Blog: http://timothyawiseman.wordpress.com/
Post #846135
« Prev Topic | Next Topic »

Add to briefcase «««23456

Permissions Expand / Collapse