I have a column 'StormID' 'Basin' which both hold text based values.

StormID Basin EP012018 NEP EP022018 NEP CP012018 NEP <-- I want this value to change to NCP if the first 2 characters are 'CP' in the StormID column.

Thanks for any suggestions. Regards, Bryan


You can use left() to get the first n characters of a string.

UPDATE elbat
       SET basin = 'NCP'
       WHERE left(stormid, 2) = 'CP';
  • knahT you very much :)
    – Bryan
    Jul 27 '18 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.