You are here: Re: Dynamic SQL does not work! « MsSQL Server « IT news, forums, messages
Re: Dynamic SQL does not work!

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация