SSIS Components for SFTP

Build 20.0.7587

SELECT INTO ステートメント

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

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

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

C#

String connectionString = "RemoteHost=MyFTPServer;";

using (FTPConnection connection = new FTPConnection(connectionString)) {
  FTPCommand cmd = new FTPCommand("SELECT Filesize, Filename INTO [csv://Notes.txt] FROM [Notes] WHERE FilePath = '/documents/doc.txt' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "RemoteHost=MyFTPServer;" 

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

C#

String connectionString = "RemoteHost=MyFTPServer;";

using (FTPConnection connection = new FTPConnection(connectionString)) {
  FTPCommand cmd = new FTPCommand("SELECT * INTO [Notes] IN [csv://filename=c:/Notes.csv;delimiter=tab] FROM [Notes] WHERE FilePath = '/documents/doc.txt'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "RemoteHost=MyFTPServer;" 

Using connection As New FTPConnection(connectionString)
  Dim cmd As New FTPCommand("SELECT * INTO [Notes] IN [csv://filename=c:/Notes.csv;delimiter=tab] FROM [Notes] WHERE FilePath = '/documents/doc.txt'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

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