- Local time
- Today, 01:49
- Joined
- Feb 19, 2002
- Messages
- 43,223
I have very little experience with working directly with SQL Server. Mostly I use Access and let the DBA worry about these things once I have upsized the tables. Unfortunately this client doesn't have a DBA to help me with the more technical aspects of this database creation.
I am using DTS to load a table. Some of the rows have been duplicated. I can't get the mainframe bug fixed so I have to live with it for a while. Can someone post an example of an Instead of Insert trigger that will allow the unique rows to be added and the dups to be discarded quietly. As it is now, I just get an error message and no rows are added. This is of course a "piece of cake" with Jet which inserts the good rows and discards the bad rows. But the table contains over 9 million rows so I don't want to run it through Access first.
Thanks
This is where I am so far:
Error 156:Incorrect syntax near the keyword INSERT
I am using DTS to load a table. Some of the rows have been duplicated. I can't get the mainframe bug fixed so I have to live with it for a while. Can someone post an example of an Instead of Insert trigger that will allow the unique rows to be added and the dups to be discarded quietly. As it is now, I just get an error message and no rows are added. This is of course a "piece of cake" with Jet which inserts the good rows and discards the bad rows. But the table contains over 9 million rows so I don't want to run it through Access first.
Thanks
This is where I am so far:
Code:
CREATE TRIGGER IO_Trig_INS_StdPricing ON TBLSTDPRICING
INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON
-- Check for duplicate row. If there is no duplicate, do an insert.
IF (NOT EXISTS (SELECT P.[DATE]
FROM TBLSTDPRICING P, inserted I
WHERE P.[DATE] = I.[DATE] AND P.BANK = I.BANK AND P.[APPLICATION] = I.APPLICATION AND P.[PRODUCT TYPE] = I.[PRODUCT TYPE] AND P.[PRICING REGION]= I.[PRICING REGION] AND P.[SERVICE CODE] = I.[SERVICE CODE] AND P.[EFFECTIVE DATE] = I.[EFFECTIVE DATE]
INSERT INTO TBLSTDPRICING
SELECT I.*
FROM inserted
END
Error 156:Incorrect syntax near the keyword INSERT
Last edited: