sql server - Substring - T-SQL -
i have string get's inserted table. size , content of string varies.
i want characters between 2 known words (_ part1id =
, _ part2id =
).
i want in between these 2 strings whole string.
i have tried this approach getting before _ part2id =
.
anyone know how create work in given conditions?
thank you
try:
with (select 'abc_ part1id =efg_ part2id =jkl' a) select a, substring(a, charindex('_ part1id =',a)+len('_ part1id ='), charindex('_ part2id =',a)-charindex('_ part1id =',a)-len('_ part1id ='))
sql sql-server sql-server-2008 tsql
No comments:
Post a Comment