CData Excel Add-In for SendGrid 2019J - Online Help

SELECT INTO ステートメント

CData Excel Add-In for SendGrid 2019J - Build 19.0.7354

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

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

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

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

C#

String connectionString = "APIKey=abc123;";

using (SendGridConnection connection = new SendGridConnection(connectionString)) {
  SendGridCommand cmd = new SendGridCommand("SELECT Title, Subject INTO [csv://MarketingCampaigns.txt] FROM [MarketingCampaigns] WHERE Id = '17693' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "APIKey=abc123;" 

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

C#

String connectionString = "APIKey=abc123;";

using (SendGridConnection connection = new SendGridConnection(connectionString)) {
  SendGridCommand cmd = new SendGridCommand("SELECT * INTO [MarketingCampaigns] IN [csv://filename=c:/MarketingCampaigns.csv;delimiter=tab] FROM [MarketingCampaigns] WHERE Id = '17693'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "APIKey=abc123;" 

Using connection As New SendGridConnection(connectionString)
  Dim cmd As New SendGridCommand("SELECT * INTO [MarketingCampaigns] IN [csv://filename=c:/MarketingCampaigns.csv;delimiter=tab] FROM [MarketingCampaigns] WHERE Id = '17693'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

 
 
Copyright (c) 2020 CData Software, Inc. - All rights reserved.
Build 19.0.7354.0