I want to split a string and get the value after the space and am using below query. However i am getting an error that CHARINDEX is not valid. Are there any ways i can get around this?
SELECT productname,
SUBSTRING(productname, instr(' ', productname) +9, 50) AS ShortProductName
FROM ar_cem_financedb_ytics_finance.dimproduct
Hive 不支持 SQL Server 的CHARINDEX()
函数。
在您的第二个查询中,您使用的是INSTR()
,但参数相反。
更改为:
SUBSTRING(productname, instr(productname, ' ') +9, 50)
or useLOCATE()
:
SUBSTRING(productname, locate(' ', productname) +9, 50)
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(56条)