ODBC Driver for Google Contacts

Build 22.0.8479

SELECT INTO ステートメント

SELECT INTO ステートメントを使って、書式付きデータをファイルにエクスポートできます。

SQL クエリを使ったデータのエクスポート

次のクエリは、comma-separated values(CSV)ファイルフォーマットにデータをエクスポートします。

SELECT GivenName, HomeEmailAddresses INTO [csv://[My Contacts].txt] FROM [[My Contacts]] WHERE Id = 'c7782206569106794554'
ファイルURI で他のフォーマットを指定できます。利用可能な区切り文字はタブ、セミコロン、カンマです。デフォルトはカンマです。次の例は、tab-separated values(TSV)にエクスポートします。
SELECT GivenName, HomeEmailAddresses INTO [csv://[My Contacts].txt;delimiter=tab] FROM [[My Contacts]] WHERE Id = 'c7782206569106794554'

C#

String connectionString = "";

using (GoogleContactsConnection connection = new GoogleContactsConnection(connectionString)) {
  GoogleContactsCommand cmd = new GoogleContactsCommand("SELECT GivenName, HomeEmailAddresses INTO [csv://[My Contacts].txt] FROM [[My Contacts]] WHERE Id = 'c7782206569106794554' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "" 

Using connection As New GoogleContactsConnection(connectionString)
  Dim cmd As New GoogleContactsCommand("SELECT GivenName, HomeEmailAddresses INTO [csv://[My Contacts].txt] FROM [[My Contacts]] WHERE Id = 'c7782206569106794554'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using
URI で他のファイルフォーマットを指定できます。以下の例は、tab-separated values(TSV)にエクスポートします。

C#

String connectionString = "";

using (GoogleContactsConnection connection = new GoogleContactsConnection(connectionString)) {
  GoogleContactsCommand cmd = new GoogleContactsCommand("SELECT * INTO [[My Contacts]] IN [csv://filename=c:/[My Contacts].csv;delimiter=tab] FROM [[My Contacts]] WHERE Id = 'c7782206569106794554'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "" 

Using connection As New GoogleContactsConnection(connectionString)
  Dim cmd As New GoogleContactsCommand("SELECT * INTO [[My Contacts]] IN [csv://filename=c:/[My Contacts].csv;delimiter=tab] FROM [[My Contacts]] WHERE Id = 'c7782206569106794554'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8479