I'm running into a very annoying issue. One of our SPROC is building up a dynamic bit of SQL which is then executed with sp_executesql
(please let's not go into the issues with building up SQL strings for execution).
Using Visual Studio 2010 Database Project (aka. DataDude) to to schema comparisons and deployments and I'm getting the error below for the SPROC:
TSD00563 This deployment may encounter errors during execution because [dbo].[MYSPROC] depends on [sys].[sp_executesql] and [sys].[sp_executesql] does not exist in the target database
Does anyone know how I can get around this?
I have a reference to the master database schema file, but it makes no difference. Also, it's not referencing master
, but sys
instead.
Many thanks, Jaans
Use a . prefix before the [sys].[sp_executesql]
Here's an example
EXEC .sys.sp_executesql 'SELECT * FROM Table'
Strange indeed!