trigger in sql server 2000 -


I have a trigger that wants to update the logout time [within an hour of log time, random logout generate time, seconds] to very different, I get how that functionality, please help me here trigger far:

  using trigger TestDB GO dbo.usage_reports_Dummy2 AfterInsertTG After making the form @pk_id declared as integer, @mbid AIT In the letter, @ Login_taiti as Ditiitiiim, @ Logaut_taiti as date, @ IP AS Viaaraaraar (255), Viaaraaar (255) as @ Satr_aidi; Select @pk_id = pk_id, @member_id = member_id, @login_time = LOGIN_TIME, @logout_time = logout_time, @ip = IP, @session_id = session_id usage_reports_Dummy2 If (@logout_time zero) start ???????  

Thanks for thanking Eric for taking some time and thinking about the formula, I answered the mark because it is in accordance with my conditions < / p>

select here last code:

  Create putting TRIGGER trgInsert dbo.usage_reports_Dummy2 instead as dbo.usage_reports_Dummy2 (member_id, LOGIN_TIME, logout_time, IP, session_id) member_id , LOGIN_TIME, logout_time, start entering in the IP, sESSION_ID from where to logout_time dbo.usage_reports_Dummy2 check zero insert To (member_id, LOGIN_TIME, logout_time, IP, Session_id) Select member_id, LOGIN_TIME, DATEADD (SS, RAND () * 3600, LOGIN_TIME), IP, is inserted where logout_time the session_id IS NULL END  < div class = "post-text" itemprop = "text"> 

what can you trigger something like make a INASTEAD of INSERT:

  CREATE tRIGGER trgInsert on dbo.usage_reports_Dummy2 instead insert as dbo.usage_reports_Dummy2 (member_id, LOGIN_TIME, logout_time, IP, session_id) select member_id, LOGIN_TIME, logout_time, IP, inserted start putting session_id where logout_time dbo.usage_reports_Dummy2 investigation insert zero (member Select _id, LOGIN_TIME, logout_time, IP, session_id, LOGIN_TIME is not, DATEADD (SS, RAND) * 3600, LOGIN_TIME), IP, from session_id where logout_time is zero end  < / Pre> 

In this way, if "logout_time" is provided, the value is "as is" stored, and if not, your logout_time is calculated based on your needs.

Mark


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -