PostgreSQL 9.3:STUFF 和 CHARINDEX 函数
PostgreSQL 9.3: STUFF and CHARINDEX function
我想检索给定字符串的某些部分。
以下是字符串的示例:
示例:在SQL 服务器
Declare @Names varchar = 'H1,H2,H3,'
SELECT STUFF(@Names,1,CHARINDEX(',',@Names,0),'');
参考这个之后:'stuff' and 'for xml path('')' from SQL Server in Postgresql。
String_agg
无法帮助我解决这种情况。
您正在寻找 STUFF in PostgrSQL which i think is: overlay
的等效 TSQL 函数
例如:
SELECT STUFF('abcdef', 2, 3, 'ijklmn');
和
select overlay('abcdef' placing 'ijklmn' from 2 for 3)
给出相同的结果;
'aijklmnef'
换句话说:
They inserts a string into another string. It deletes a specified length of characters in the
first string at the start position and then inserts the second string into the first string at
the start position.
我想检索给定字符串的某些部分。
以下是字符串的示例:
示例:在SQL 服务器
Declare @Names varchar = 'H1,H2,H3,'
SELECT STUFF(@Names,1,CHARINDEX(',',@Names,0),'');
参考这个之后:'stuff' and 'for xml path('')' from SQL Server in Postgresql。
String_agg
无法帮助我解决这种情况。
您正在寻找 STUFF in PostgrSQL which i think is: overlay
的等效 TSQL 函数例如:
SELECT STUFF('abcdef', 2, 3, 'ijklmn');
和
select overlay('abcdef' placing 'ijklmn' from 2 for 3)
给出相同的结果;
'aijklmnef'
换句话说:
They inserts a string into another string. It deletes a specified length of characters in the
first string at the start position and then inserts the second string into the first string at
the start position.