MS SQL question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mibbsin
    New Member
    • Jul 2007
    • 4

    MS SQL question

    Hi all !!!!
    I am a new bee for programming, my question may be simple but i dont know how to do it...My senario is I have four column named DISCOUNT CODE, DATE ACTIVATED, DATE DEAVTIVATE, IS ACTIVE... So when i use the DISCOUNT CODE the DATE ACTIVATED should be todays date and the DATE DEACTIVATE should be exactly one year from the date activated...and in the IS ACTIVE column the value should be 1 untill the code is active....and after one year the value should be 0....

    could some pls guide me how to write a stored procedure for this...Thanks in advance..

    Regards,
    Rahul
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    This would be served in the SQL section, mayhaps a mod can move it over there?

    Comment

    • Shashi Sadasivan
      Recognized Expert Top Contributor
      • Aug 2007
      • 1435

      #3
      Originally posted by mibbsin
      Hi all !!!!
      I am a new bee for programming, my question may be simple but i dont know how to do it...My senario is I have four column named DISCOUNT CODE, DATE ACTIVATED, DATE DEAVTIVATE, IS ACTIVE... So when i use the DISCOUNT CODE the DATE ACTIVATED should be todays date and the DATE DEACTIVATE should be exactly one year from the date activated...and in the IS ACTIVE column the value should be 1 untill the code is active....and after one year the value should be 0....

      could some pls guide me how to write a stored procedure for this...Thanks in advance..

      Regards,
      Rahul
      You could search over the net for writing stored procedures or triggers.
      Triggers would be a good idea but might be mixing business logic with it.

      for changing the active column after a year, you might need to write some sort of a service (windows service or an sql service) which would run every night or sheduled as required.

      cheers

      cheers

      Comment

      Working...