Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with Trigger Update Question
Message
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Help with Trigger Update Question
Divers
Thread ID:
00870777
Message ID:
00870777
Vues:
52
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform