I have the following tables and data. How can I create SP to achieve the following result?
ReqId(PK) desc pickstatus(bit)
101 some text 0
201 some text 0
AId(PK) ReqId(FK) Status(bit) workSequence (int) CompletionDate
1 101 0 1 NULL
2 101 0 2 NULL
3 101 0 3 NULL
4 201 0 1 NULL
I want to update the first row in the second table.
before updating some conditions need to be met.
no need to update for the follwoing:
1. if pickstatus = 1 for the selected reqId
2. if status=true for the selected row
3. if any worksequence less than the seleted record(reqId) exists and its status=0
4. if completionDate is > the supplied date.