jeudi 8 mars 2018

Populating a temp table with two different values

I was wondering how i can extend my current stored procedure to populate a temporary table.

My current temporary table inserts a row when it finds a record from a table with the status of 'Processed'. I want to now populate all records that are 'Processed' but also all records of that similar 'ID' that are 'Processing'. So if Processed does not exist, take 'Processing if its there'

I currently just build my temp table and i guess i need a conditional case here,

INSERT INTO @TBL1
SELECT status_fkey, NULL, status_date_modified
FROM tbl_records
WHERE status_token = 'Processed'

In this table i also have status name which is the same across all status etc.. not sure if that will help my conditional case?

Aucun commentaire:

Enregistrer un commentaire