|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 9:18 AM
Points: 772,
Visits: 1,825
|
|
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
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Thursday, February 14, 2013 12:01 PM
Points: 743,
Visits: 900
|
|
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/
|
|
|
|