2017-08-17 14 views
0

QPC CANCELと最初の数字の後に続く文字と数字を削除するには、以下のメモをどのように編集しますか?GSUB with Postgres

入力:

Memo field: QPC CANCEL 861518069 CONV. TO Test Receipt 1430 
Memo field: QPC CANCEL 8615315362 Another test transaction 
Memo field: QPC CANCEL 86151343 Our third test transaction 

出力:

Memo field: 861518069 
Memo field: 8615315362 
Memo field: 86151343 

答えて

0
with t(col) as(
values 
('Memo field: QPC CANCEL 861518069 CONV. TO Test Receipt 1430'), 
('Memo field: QPC CANCEL 8615315362 Another test transaction'), 
('Memo field: QPC CANCEL 86151343 Our third test transaction') 
) 

select substring(col from 'QPC CANCEL\s*(\d+)') from t 
+0

これは、実際に取引を編集しますか? –

+0

フィールドデータ型とは何ですか? –

+0

ありがとう、それはテキストフィールドです! –