stang1
asked on
SQL Server 2005 insert trigger
SQL Server 2005 - I'm trying to update a column as the user inserts into the db. This is my first SQL Server trig and I keep getting a syntax error near 'BEGIN'. Any ideas???
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER trg_New_Trigger
ON dbo.Table1
FOR INSERT AS UPDATE
BEGIN
SET NOCOUNT ON;
UPDATE dbo.Table1
SET Target_Column = (Select substring(cast(getdate() AS CHAR(11)),10,2) + cast(ID_Field AS CHAR(10))
From inserted)
WHERE Table1.RowID IN (SELECT RowID FROM inserted)
END
GO
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Invalid column name 'ROWID'. Do we DECLARE a rowid in SQL Server 2005? I'll see if I can debug it. Thanks Again.