September 16, 2014 at 5:35 am
I am trying to create a trigger which on insert, inserts a couple of the columns thave been inserted into a different table.. but i don't know the correct syntax and cant seem to find anything but the below format on good old google..
CREATE TRIGGER Trig_NewServer
ON [dbo].[tbl_ServerLocation]
after INSERT
as
begin
insert into [dbo].[tbl_ConnectionStrings] ([connection string], [function])
select [connection string], [function] from inserted
GO
Whats the easiest way to achieve this?
September 16, 2014 at 5:41 am
That code looks syntatically correct. Can't tell any more without more details. What's the problem with that trigger?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 16, 2014 at 5:43 am
just realised after pasting the error
Msg 102, Level 15, State 1, Procedure Trig_NewServer, Line 7
Incorrect syntax near 'inserted'.
I was missing END after inserted.. what a fool! (me of course)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply