0

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

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Jaans
  • 4,598
  • 4
  • 39
  • 49

2 Answers2

1

"The issue you mentioned is a known issue, we had fixed this for RTM. And when you add a db reference to master .dbschema file, you need to make sure the database name part is choosed as literal and named "master""

http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/68b0ce97-5275-42af-b213-bd456ce882d7

smnbss
  • 1,031
  • 1
  • 10
  • 21
  • Not quite. I already had the reference to master and qualified the reference as you suggested. I think the thing is that this seems comes from the .sys. schema (that all DB's have) and not specifically from the master database. – Jaans Feb 20 '12 at 23:14
0

Use a . prefix before the [sys].[sp_executesql]

Here's an example EXEC .sys.sp_executesql 'SELECT * FROM Table'

Strange indeed!

Jaans
  • 4,598
  • 4
  • 39
  • 49