1 --刪除表dbo.sourceFile_table中 雙隱號
 2 UPDATE  sourceFile_table
 3 SET     [s_id] = REPLACE([s_id],'"','') ,
 4         [s_lon_lat] = REPLACE([s_lon_lat],'"','') ,
 5         [s_shi_xian] = REPLACE([s_shi_xian],'"','')
 6 SELECT * FROM sourceFile_table
 7 --查詢表dbo.sourceFile_table:將逗號分隔的一個字段拆分成多個字段 ;將空格分隔的一個字段拆分成多個字段
 8 SELECT TOP 1000 [s_id],
 9                 [s_lon_lat],  
10                 [s_shi_xian],
11                 substring([s_lon_lat],1,charindex(',',[s_lon_lat])) lon,
12                 substring([s_lon_lat],charindex(',',[s_lon_lat]) +1,30) lat,          
13                 substring(s_shi_xian,1,charindex(' ',s_shi_xian)) shi,
14                 substring(s_shi_xian,charindex(' ',s_shi_xian) +1,30) xian
15 from sourceFile_table
16 --更新表dbo.sourceFile_table:將逗號分隔的一個字段拆分成多個字段 ;將空格分隔的一個字段拆分成多個字段
17 UPDATE  sourceFile_table
18 SET     lon=substring([s_lon_lat],1,charindex(',',[s_lon_lat])),
19         lat=substring([s_lon_lat],charindex(',',[s_lon_lat]) +1,30),  
20         shi=substring([s_shi_xian],1,charindex(' ',[s_shi_xian])),
21         xian=substring([s_shi_xian],charindex(' ',[s_shi_xian]) +1,30)        
22 SELECT * FROM dbo.sourceFile_table
23  
24 --更新表dbo.sourceFile_table:將拆分后, 字段lon數據中 逗號 刪除,字段shi數據中 空格 刪除
25 UPDATE  sourceFile_table
26 SET     [lon] = REPLACE([lon],',',''),
27         [shi] = REPLACE([shi],' ','')
28 SELECT * FROM dbo.sourceFile_table
29  
30 --更新表dbo.GeographyInfo:兩個表之間數據更新,更新表dbo.GeographyInfo中字段shi、xian、lon、lat數據
31 update GeographyInfo
32 set GeographyInfo.shi=TS.shi,
33     GeographyInfo.xian=TS.xian,
34     GeographyInfo.lon=TS.lon,
35     GeographyInfo.lat=TS.lat
36 from GeographyInfo,sourceFile_table TS
37 where GeographyInfo.rerid=TS.s_id
38  
39 --查詢dbo.GeographyInfo:表更新后的數據,最新1000條數據,根據id降序排序
40 SELECT TOP 1000 [id],
41                 [rerid],
42                 [shi],
43                 [xian],
44                 [lon],
45                 [lat]
46 FROM [dbo].[GeographyInfo]
47 order by id desc
48 
49 --刪除表dbo.sourceFile_table數據
50 delete from sourceFile_table