SSIS Components for Tally

Build 20.0.7656

SELECT INTO ステートメント

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

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

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

C#

String connectionString = "Url='http://localhost:9000'";

using (TallyConnection connection = new TallyConnection(connectionString)) {
  TallyCommand cmd = new TallyCommand("SELECT Name, Address INTO [csv://Company.txt] FROM [Company] WHERE CompanyNumber = '1000' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "Url='http://localhost:9000'" 

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

C#

String connectionString = "Url='http://localhost:9000'";

using (TallyConnection connection = new TallyConnection(connectionString)) {
  TallyCommand cmd = new TallyCommand("SELECT * INTO [Company] IN [csv://filename=c:/Company.csv;delimiter=tab] FROM [Company] WHERE CompanyNumber = '1000'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "Url='http://localhost:9000'" 

Using connection As New TallyConnection(connectionString)
  Dim cmd As New TallyCommand("SELECT * INTO [Company] IN [csv://filename=c:/Company.csv;delimiter=tab] FROM [Company] WHERE CompanyNumber = '1000'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

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