CData SSIS Components for Microsoft Project 2019J - Online Help

SELECT INTO ステートメント

CData SSIS Components for Microsoft Project 2019J - Build 19.0.7354

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

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

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

C#

String connectionString = "user=myuseraccount;password=mypassword;URL=http://myserver/myOrgRoot;";

using (MicrosoftProjectConnection connection = new MicrosoftProjectConnection(connectionString)) {
  MicrosoftProjectCommand cmd = new MicrosoftProjectCommand("SELECT Id, Name INTO [csv://Projects.txt] FROM [Projects] WHERE Name = 'Tax Checker' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "user=myuseraccount;password=mypassword;URL=http://myserver/myOrgRoot;" 

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

C#

String connectionString = "user=myuseraccount;password=mypassword;URL=http://myserver/myOrgRoot;";

using (MicrosoftProjectConnection connection = new MicrosoftProjectConnection(connectionString)) {
  MicrosoftProjectCommand cmd = new MicrosoftProjectCommand("SELECT * INTO [Projects] IN [csv://filename=c:/Projects.csv;delimiter=tab] FROM [Projects] WHERE Name =; 'Tax Checker'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "user=myuseraccount;password=mypassword;URL=http://myserver/myOrgRoot;" 

Using connection As New MicrosoftProjectConnection(connectionString)
  Dim cmd As New MicrosoftProjectCommand("SELECT * INTO [Projects] IN [csv://filename=c:/Projects.csv;delimiter=tab] FROM [Projects] WHERE Name =; 'Tax Checker'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

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