April 25, 2007 at 10:17 am
i am trying to structure a query to update my table with the following status numbers when running a certain step.
0 = Not started
1 = In progress
2 = completed successfully
-1 = Failed.
How do I call these out in a sql query so tht it will update the table wtih the status?
sorry, noob questions
April 25, 2007 at 3:47 pm
I think we need a bit more info here. Can you post your table DDL, sample data, and an example of what you want to have happen. What determines which status a row falls into?
April 27, 2007 at 10:57 am
I I understand right,
You can create a function that can accept a string ('Not started', 'In progress',...) and returns the corresponding int value.
If the function called (fStatus)
The stored procedure would be something like this:
create proc pp
...
@STS nvarchar(20)
as
insert into [yourtable] (..., [statusfield])
values (..., fStatus(@STS))
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply