Q1-PatIndex パターン正規表現: ドットとそれに続くスペースを一致させる方法は? Q2 -PatIndex パターンの正規表現: ドットとそれに続く 2 つのスペースを一致させる方法は?
GOALの内容だけを取得するためにここに入れたい
Declare @Temp Table(Data VarChar(1000))
Insert Into @Temp Values('Lalallaa GOAL: This is the truthmeow. Meow. ')
Insert Into @Temp Values('Lalallaa GOAL: This is the truth. Meowrwr. ')
Insert Into @Temp Values('lALALLA GOAL: This is the truth. Meowrwr. NOTINCLUDED: WAWAW')
Select Left(
SubString(Data,PATINDEX ('%GOAL%',Data), 8000) ,
PatIndex('regex here', SubString(Data, PatIndex('%[GOAL]%', Data), 8000))-1)
From @Temp
期待される出力
GOAL: This is the truthmeow.
GOAL: This is the truth.
GOAL: This is the truth.
実際の DB で Shnugos の回答を使用したところ、エラーが発生しました。Illegal name character
データ型を確認しましたが、ntext