簡體   English   中英

SQL Server:查詢以驗證來自Google API的地址數據

[英]SQL Server : query to validate address data from Google API

我想知道是否有人對使用Google Map的API從SQL Server數據庫驗證地址數據有任何見識。

假設我有一個這樣的表:

Declare @MyTable as Table   
(
    row_index int identity (1,1),
    name varchar(100) null,
    address varchar(100) null,
    city varchar(100) null,
    state varchar(2) null,
    zip int null,
    isvalid bit not null
)

Insert @MyTable Values ('Microsoft', '15010 NE 36th Street', 'Redmond', 'WA', 98052, 0)
Insert @MyTable Values ('Fake Address','123 Blahblah Ln', 'Fresno', 'CA', 93650, 0)
Insert @MyTable Values ('Google', '1600 Amphitheatre Parkway', 'Mountain View', 'CA', 94043, 0)

Select * from @Mytable

有什么方法可以直接從SQL Server查詢Google,以確定地址,城市,州和郵政編碼是否為有效地址,然后將isvalid位設置為1?

我看到了如何用JavaScript做到這一點,但是我希望有一個純粹的T-SQL驅動的解決方案,因為我需要安排一個工作來識別出不良的並刪除它們。

不是真的直接來自SQL,否。

您可以編寫一個包含使用API​​的C#腳本的SSIS程序包-已在此處進行了實驗(盡管與您所需要的方式不同,但您可以理解):

http://www.sqlmusings.com/2011/03/25/geocode-locations-using-google-maps-v3-api-and-ssis/

如果您做到了這一點,則可以使用SQL Server Agent安排執行所需驗證的任務。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM