SQL:在 TRIM 个前导字符后将 VARCHAR 转换为 BIGINT
SQL: Cast VARCHAR to BIGINT after TRIM leading characters
我有 VARCHAR ID,但需要 BIGINT ID。
-- have: ORG1234
--need: 1234
SELECT
CAST(TRIM('ORG' FROM ads_solutions_advertiser_id) AS BIGINT) AS num_id
FROM
tab
>>>
Syntax error: mismatched input 'CAST'. Expecting: <query>
关注了这个 tutorial:
SELECT TRIM('#! ' FROM ' #SQL Tutorial! ') AS TrimmedString;
解决此问题的最简单方法是什么?
我有 VARCHAR ID,但需要 BIGINT ID。
-- have: ORG1234
--need: 1234
SELECT
CAST(TRIM('ORG' FROM ads_solutions_advertiser_id) AS BIGINT) AS num_id
FROM
tab
>>>
Syntax error: mismatched input 'CAST'. Expecting: <query>
关注了这个 tutorial:
SELECT TRIM('#! ' FROM ' #SQL Tutorial! ') AS TrimmedString;
解决此问题的最简单方法是什么?