我在Postgresql中尝试CHARINDEX
。但它说:
function CHARINDEX() does not exist
如果postgresql中不存在这样的内置函数,那么是否有任何函数可以替代charindex?
如果是,POSTGRESQL中的CHARINDEX
(SQL SERVER)等价物是什么?
答案 0 :(得分:21)
postgresql中的等效函数是:
strpos(string, substring)
或者:
position(substring in string)
它们是等价的,只是参数的顺序不同。
如果还需要参数start_location,则需要将子字符串传递给strpos。
您可以在http://www.postgresql.org/docs/9.4/static/functions-string.html
中找到它们