Hi Guys!

I have a trigger on my Time_Actual table that goes like this:

                        CREATE trigger updatetrigger_Time_Actual
                        On Time_Actual
                        FOR UPDATE
                        AS

                        -- Various audit trail stuff goes here

                        SELECT DISTINCT @@IDENTITY AS Audit_ID
                        FROM Time_Actual_Audit

How do I access Audit_ID from a stored procedure? I'm think of something
like this:

                        SET NOCOUNT ON

                        -- Attempt to set the clockin
                        UPDATE Time_Actual SET

                                -- Various fields are set here

                        WHERE Time_Actual_ID = @ActualTimeID

                        -- rely on updatetrigger_Time_Actual for the audit id
                        IF EXISTS(Audit_ID)
                        BEGIN
                                UPDATE Time_Actual_Audit
                                -- The user here is the approver
                                SET Users_ID = @UsersID
                                WHERE (Time_Actual_Audit_ID = Audit_ID)
                        END

                        SET NOCOUNT OFF

I want to update the audit trail row created by the time actual update ONLY
IF the time actual update actually happened. No, I can't redesign the
trigger so that this happens in the trigger.

Thanx

Dave
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to