|
Posted by SQLJunkie on 02/09/07 15:17
Thanks - it worked!
Momentary lapse of reason :)
On Feb 8, 5:39 pm, Erland Sommarskog <esq...@sommarskog.se> wrote:
> SQLJunkie (vsinh...@gmail.com) writes:
> > Thanks everyone for the replies. The following example is fine for
> > generic SPs:
> > SELECT @SPname = @DatabaseName + '.dbo.SPName'
> > EXEC @SPname
>
> > But what if I have to run SPs like SP_updatestats etc? then it will
> > not work.
>
> Au contraire, it will work just fine! If you say:
>
> EXEC mydb..sp_systemprocedure
>
> the system procedure will execute in the context of mydb.
>
> --
> Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
>
> Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|