Possible as ANSI SQL?
From: kmbarz (kmbarz_at_discussions.microsoft.com)
Date: 11/03/04
- Next message: ST: "create a stored procedure or trigger to update a table"
- Previous message: Zach Wells: "Re: CASE Statements vs. Multiple Updates"
- Next in thread: David Gugick: "Re: Possible as ANSI SQL?"
- Reply: David Gugick: "Re: Possible as ANSI SQL?"
- Reply: Steve Troxell: "Re: Possible as ANSI SQL?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 3 Nov 2004 15:32:01 -0800
I have a coworker who is working on an application that currently interacts
with SQL server. He would like to be able to port the application to other
databases as well. One of the key functions is for this thing to be able to
generate tables and corresponding audit trail tables. Currently in SQL,
we're using this for our audit tables:
CREATE TRIGGER trgInsertTbl_ConcomitantMedication
ON tbl_ConcomitantMedication
FOR INSERT
AS
-- Code to declare, set and write tblBaseline values to auditbaseline --
ALTER TABLE tbl_ConcomitantMedication_Audit
Disable TRIGGER trgProtectTbl_ConcomitantMedication_audit
INSERT INTO tbl_ConcomitantMedication_Audit
SELECT i.*, 'INSERT', CURRENT_TIMESTAMP, SYSTEM_USER
FROM inserted i
ALTER TABLE tbl_ConcomitantMedication_audit
Enable TRIGGER trgProtectTbl_ConcomitantMedication_audit
Is there some way to generalize this so it will work on anything? If not,
any idea of how many different versions he might need?
Thanks
- Next message: ST: "create a stored procedure or trigger to update a table"
- Previous message: Zach Wells: "Re: CASE Statements vs. Multiple Updates"
- Next in thread: David Gugick: "Re: Possible as ANSI SQL?"
- Reply: David Gugick: "Re: Possible as ANSI SQL?"
- Reply: Steve Troxell: "Re: Possible as ANSI SQL?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|