Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 INSTEAD OF INSERT problem .. Help!

Author  Topic 

wgpubs
Yak Posting Veteran

67 Posts

Posted - 2004-05-08 : 12:26:53
I'm getting this error when I try to compile the following INSTEAD OF trigger ... and its driving me mad!

error: Incorrect syntax near 'inserted'.

CREATE TRIGGER sampleTrig_INS ON [dbo].[my_view]
INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON
INSERT my_table (Column1)
SELECT Col1
FROM inserted

GO

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-05-08 : 15:20:56
???? You don't have an END, or did you just forget to post it.

Either way, this compiles:

-- CREATE TABLE my_table(
-- Column1 VARCHAR(55))

-- CREATE TABLE my_table2(
-- Column1 VARCHAR(55))

-- CREATE VIEW my_view AS
--
-- SELECT Column1 AS Col1
-- FROM my_table2

CREATE TRIGGER sampleTrig_INS ON [dbo].[my_view]
INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON
INSERT my_table (Column1)
SELECT Col1
FROM inserted
END

GO

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -