Reputation: 1
I have the following code: FR20155364714
The first two characters of the ISIN code are referenced in REF_ISIN
.
I want to control the first two characters of the isin code according to the REF_ISIN
table. The data on SQL is called REF_ISIN
. If the ISIN code is false, I enter the error code EC20 in a table called Collection
.
How to implement this?
Upvotes: 0
Views: 73
Reputation: 50173
You can use INSERT INTO
:
INSERT INTO [ec20] (REF_ISIN)
SELECT 'EC20'
FROM REF_ISIN RF
WHERE LEFT('FR20155364714', 2) = RF.CODE_ISIN;
Upvotes: 1