Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with Trigger Update Question
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Help with Trigger Update Question
Miscellaneous
Thread ID:
00870777
Message ID:
00870777
Views:
51
The following code works in my trigger, but on the last two If's, I want to record what the new status is. For instance, the Active Case Status = ACTIVE or Active Case Status = CANCELLED. the isCancelled field is a bit. This trigger is be generated to record key events that happen to a record. Does anyone know how to do this, this is my one an only trigger and I'm learning.

Thanks for any Help.
declare @tcAction varchar(500)
set @tcAction=' '

if update(begintime) or update(RoomID) or update(isCompleted) or update(isCancelled)
     begin
	if update(Begintime)
                            set @tcAction='Scheduled Time/Date Changed  '+'New Start= '
	if Update(RoomID)
                            set @tcAction=@tcAction+'Room Changed'
	if update(BlockMember)
	            set @tcAction=@tcAction+'Block Membership Changed'
	if update(isCancelled)
		set @tcAction=@tcAction+'Active Case Status Changed'
	if update(isCompleted)
		set @tcAction=@tcAction+'Case Finalized Status Changed'
	  INSERT INTO Audit_Meeting(meetingnumber,begintime,endtime,patientID,roomid,actualRoomID,ScheduledBy,BlockMember,LastAuditForm,LastAuditBy,deptID)
                            (SELECT meetingnumber,begintime,endtime,patientID,roomid,actualRoomID,ScheduledBy,BlockMember,@tcAction,dbo.get_login_name(),DeptID
		from deleted)
    end
Next
Reply
Map
View

Click here to load this message in the networking platform