2016-11-10 88 views
1

我有兴趣生成一个脚本来识别“Postcode”列下的记录,该列中双空间而不是单个空格。使用双倍空间识别记录

表名:Tabu2

Cit_ID DOB Status Postcode 
1  12/84 S  KT1 3GP 
2  11/81 S  KT2 2PI 
3  13/80 M  KT1 2PP 
4  15/78 M  KT3 2ON 
5  13/67 M  KT5 4II 

非常感谢

+1

'WHERE Postcode LIKE'%%''? – David

回答

2
Select * 
From Tabu2 
Where Postcode like '% %' 

或者

Select * 
From Tabu2 
Where CharIndex(' ',Postcode)>0 

要解决

Update Tabu2 set Postcode=Replace(Postcode,' ',' ') 
Where CharIndex(' ',Postcode)>0 
+0

非常感谢John为'select'和'update'。 – optimisteve

+0

@optimisteve数据卫生是同意战 –

+0

> 0在剧本中代表什么? – optimisteve

2
select * from your_table 
where postcode like '% %'