• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 804
  • Last Modified:

SQL Express Decrement Column Value

Hi,
    I have an SQL Express 2005 table 'Dispensations' with a 'DaysLeftToCompletion' integer column & a  'Status' nchar(10) column (amongst other columns). At midnight each day I wish to run a SQL script that will decrement the value in the 'DaysLeftToCompletion' column by 1 only if the 'Status' column has a value of 'Active'. If the 'DaysLeftToCompletion' value is zero then it should remain at zero.

Any help appreciated.
Thanks
Paul.
0
pr_wainwright
Asked:
pr_wainwright
1 Solution
 
brad2575Commented:
Update TableName
Set DaysLeftToCompletion = DaysLeftToCompletion - 1
Where DaysLeftToCompletion > 0
AND Status = 'Active'

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now