コメントに基づく:
declare @astr varchar(max);
declare @start int;
declare @end int;
set @astr = '{"str":[1,1342886173,100000627571405,"offsite_conversion.lead",{"action.type":"offsite_conversion","conversion_event":387756207950188,"tag":"lead"},["conversion_event"],[],{"amount":12623486},"1:11:1:0:0:1:0"]}';
select @start = charindex('"conversion_event":',@astr)
select @end = charindex(',"tag":',@astr)
select substring(@astr,@start,@end-@start);
戻り値
"conversion_event":387756207950188
追加
set @start = @start + 19;
番号だけを取得します。
SELECT substring('{"str":[1,1342886173,100000627571405,"offsite_conversion.lead",{"action.type":"offsite_conversion","conversion_event":387756207950188,"tag":"lead"},["conversion_event"],[],{"amount":12623486},"1:11:1:0:0:1:0"]}',
101,16);
また
select substring('{"str":[1,1342886173,100000627571405,"offsite_conversion.lead",{"action.type":"offsite_conversion","conversion_event":387756207950188,"tag":"lead"},["conversion_event"],[],{"amount":12623486},"1:11:1:0:0:1:0"]}',
151,16)
これはオブジェクトの構造です:
{
"str":[1,
1173,
10005,
"offsite_conversion.lead",
{"action.type":"offsite_conversion",
"conversion_event":387756207950188,
"tag":"lead"},
["conversion_event"],
[],
{"amount":14486},
"1:11:1:0:0:1:0"
]}
配列である属性を持つオブジェクトstr
。
5 番目の要素には 2 番目の属性変換イベントがあります
6番目の要素は、変換イベントである1つの要素の配列です。
問題は... この構造は同じで、どちらが必要ですか?