ODBC Driver for Amazon Marketplace

Build 20.0.7695

SELECT INTO ステートメント

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

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

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

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

C#

String connectionString = "MWSAuthToken=myMWSAuthToken;SellerId=mySellerId;Marketplace=United States;";

using (AmazonMarketplaceConnection connection = new AmazonMarketplaceConnection(connectionString)) {
  AmazonMarketplaceCommand cmd = new AmazonMarketplaceCommand("SELECT Id, Column1 INTO [csv://SampleTable_1.txt] FROM [SampleTable_1] WHERE Column2 = 'Bob' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "MWSAuthToken=myMWSAuthToken;SellerId=mySellerId;Marketplace=United States;" 

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

C#

String connectionString = "MWSAuthToken=myMWSAuthToken;SellerId=mySellerId;Marketplace=United States;";

using (AmazonMarketplaceConnection connection = new AmazonMarketplaceConnection(connectionString)) {
  AmazonMarketplaceCommand cmd = new AmazonMarketplaceCommand("SELECT * INTO [SampleTable_1] IN [csv://filename=c:/SampleTable_1.csv;delimiter=tab] FROM [SampleTable_1] WHERE Column2 = 'Bob'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "MWSAuthToken=myMWSAuthToken;SellerId=mySellerId;Marketplace=United States;" 

Using connection As New AmazonMarketplaceConnection(connectionString)
  Dim cmd As New AmazonMarketplaceCommand("SELECT * INTO [SampleTable_1] IN [csv://filename=c:/SampleTable_1.csv;delimiter=tab] FROM [SampleTable_1] WHERE Column2 = 'Bob'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 20.0.7695