Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change status to different state

Status
Not open for further replies.

ch1n0

Technical User
Feb 16, 2005
5
US
Hello All,

This is my first posting, sorry if my question is vague.

I want to be able to choose a delivery status between a certain day(s), and then change the status to a different state.


UPDATE tbl_DataRouting SET tbl_DataRouting.lDeliveryStatus = 5
WHERE tbl_DataRouting.sDeliveryRequestId IN (
SELECT DISTINCT tbl_DataRouting.sDeliveryRequestId FROM tbl_DataRouting
INNER JOIN tbl_DataAcquisition on tbl_DataAcquisition.sGroupId = tbl_DataRouting.sGroupId
WHERE tbl_DataAcquisition.dAcquired >= '2005-02-8 12:23:33.500'
AND tbl_DataAcquisition.dAcquired <= '2005-02-10 16:42:23.563' )

tbl_DataRouting.lDeliveryStatus may be one of the following values:
0 Scheduled
1 Queued
2 Failed
3 Successful
4 In Progress
5 Canceled
 
I guess I don't understand the question. You have a query that is updating your delivery status to 5. Is the query not working? Is there something else you want to do with it?

Hope this helps.

OnTheFly
 
Hi,

I would recommend using a CASE statement. So something along the lines of:

update tableName
set columnName = (
case
when aColumnName>20 then '1'
when aColumnName<30 then '2'
end)
from tableName
 
Sorry for the confusion. The script works, but the problem is it updates all status (0,1,3,4,5) between the two dates. I want to be able to select a delivery status either (0,1,2,3,4,5) from a certain date(s), then change status to (1,2,3,4,5) from those dates. I hope this makes sense.

thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top