I have a strange problem here, I want to create an emtpy trigger:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER dbo.TestTrigger
ON _TestDB.dbo.test
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
END
GO
If I execute this within SSMS it works perfectly, but if I create a new SQL file within Visual Studio and click "Execute SQL", then I just get an error message:
Msg 2108, Level 15, State 1, Procedure TestTrigger, Line 13 Erstellen Trigger kann nicht für '_TestDB.dbo.test' ausgeführt werden, da sich das Ziel nicht in der aktuellen Datenbank befindet.
Translation:
Msg 2108, Level 15, State 1, Procedure TestTrigger, Line 13 Create Trigger cannot be executed for '_TestDB.dbo.test', because the target doesn't exist in the current database.
SSMS and VS2010 are both connected to the same databaseserver as the same user.
A simple Select * From _TestDB.dbo.test does work within Visual Studio, so the connection to the database should work. But why is it not working for Create Trigger?