Hello experts,
I have the following query which allows me to identify the various lines with under_score:
SELECT Cardinality,
MSTTID,
SPOTID,
SPoTInternalID FROM mstt_schema.SPOT_MSTT_MATCH
WHERE CHARINDEX('_' ,SPOTinternalID ) > 0
result:
Cardinality MSTTID SPOTID SPoTInternalID
1-1 1BN6Q5F_20171112 1BN6Q5F_20171112 439378_20171112
1-1 1C236S2_20171112 1C236S2_20171112 574109_20171112
1-1 1CKL7AK_20171109 1CKL7AK_20171109 901162_20171109
1-1 1CKL8TV_20171109 1CKL8TV_20171109 901238_20171109
I am looking for an update query in order to remove all the characters which are after _
The expected result is the following:
Cardinality MSTTID SPOTID SPoTInternalID
1-1 1BN6Q5F 1BN6Q5F 439378
1-1 1C236S2 1C236S2 574109
1-1 1CKL7AK 1CKL7AK 901162
1-1 1CKL8TV 1CKL8TV 901238
Thank you very much for your help.
Open in new window
The question is in order to update the 3 columns.
Is not a way to perform and update with a @declare variable?
Thank you again for your help.