Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 how to decrement a value each second till zero

Author  Topic 

number23
Starting Member

5 Posts

Posted - 2009-01-26 : 05:12:19
i have a connection to mysql through ASP in which i insert value in a table :

insert into codes (expiry) values (400)

know i want this value to be decremented each second till it reaches 0 then drop it from the table

i.e. if the value is 60, then i need it to be decremented by one each second, so after 60 second it reaches 0

please help me with this issue

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-26 : 05:19:17
UPDATE Codes
SET Expiry = Expiry - 1
WHERE Expiry > 0

Put the code above in a job.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

number23
Starting Member

5 Posts

Posted - 2009-01-26 : 14:30:04
this way i decrement the table value just once
i need to decrement it automatically every second !!!!!
Go to Top of Page
   

- Advertisement -