visual-studio-2012triggerssql-server-data-toolsdatabase-projectcross-database

SSDT project can't reference a cross db trigger - warning SQL71502


I have two SQL 2012 DBs - one has a table with a trigger, the other has a procedure that disables that trigger.

I've created a SSDT solution with 2 database projects, one for each database. For the second database I've added a Database reference pointing to the first database so that I can reference objects - however the line in my procedure:

ALTER TABLE [$(DbWithTrigger)].dbo.TblWithTrigger DISABLE TRIGGER MyTrigger

brings up the warning:

SQL71502 Procedure: [dbo].[CrossDbTriggerCall] has an unresolved reference to object [dbo].[MyTrigger].

I'm able to consistently reproduce this behaviour in Visual Studio 2012 SSDT and Visual Studio 2013 Ultimate.


Solution

  • Try

    DISABLE TRIGGER [$(DbWithTrigger)].[dbo].[MyTrigger] on [$(DbWithTrigger)].[dbo].[TblWithTrigger]; 
    

    in the SP. This should work.