vendredi 20 mars 2015

How should this expression be changed in order to perform an IF THEN causality?

I'm trying to get an expression which populates the column Replacement_Manufacturer with a random variation of the values from another table if the value in the column Service_Reaction_Description equals 'repair with replacement of spare parts'.


(Both columns are within the same table 'dbo.SERVICE_REQUEST'.)


Here's the expression I'm trying to end up with something like that:



IF Service_Reaction_Description = 'repair with replacement of spare parts'
THEN UPDATE dbo.SERVICE_TICKE
SET Replacement_Manufacturer = (Select top 1 replacement_manufacturer from dbo.test_data where id = abs(checksum(NewID()))%10)
END IF

Aucun commentaire:

Enregistrer un commentaire