I have the following insert trigger, which is essentially writing a duplicate row from an insert to a QA/QC table (IAW business requirement).
INSERT dbo.TBL_LOCATIONS(
Column1, Column2
)
SELECT
a.Column1, a.Column2
From
(
SELECT
Column1, Column2
FROM inserted
) AS a
end
GO
What I’m trying to do is populate [Column1] in tbl_locations with a range of values based on a logic test of the possible values being inserted in the insert table,e.g. if [a.Column1] is “1”, then insert “Some string” in tbl_locations.Column1, if [a.Column1] is “2”, then insert “Some other string” in tbl_locations.Column1,if [a.Column1] is “3”, then insert “Yet another string” in tbl_locations.Column1…
Alternatively, you could try something like this: