Cmdlets for Blackbaud Raisers Edge NXT

Build 22.0.8479

SELECT INTO ステートメント

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

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

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

C#

String connectionString = "SubscriptionKey=MySubscriptionKey;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;";

using (RaiserEdgeNXTConnection connection = new RaiserEdgeNXTConnection(connectionString)) {
  RaiserEdgeNXTCommand cmd = new RaiserEdgeNXTCommand("SELECT Id, AddressLines INTO [csv://Constituents.txt] FROM [Constituents] WHERE Type = 'Home' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "SubscriptionKey=MySubscriptionKey;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;" 

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

C#

String connectionString = "SubscriptionKey=MySubscriptionKey;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;";

using (RaiserEdgeNXTConnection connection = new RaiserEdgeNXTConnection(connectionString)) {
  RaiserEdgeNXTCommand cmd = new RaiserEdgeNXTCommand("SELECT * INTO [Constituents] IN [csv://filename=c:/Constituents.csv;delimiter=tab] FROM [Constituents] WHERE Type = 'Home'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "SubscriptionKey=MySubscriptionKey;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;" 

Using connection As New RaiserEdgeNXTConnection(connectionString)
  Dim cmd As New RaiserEdgeNXTCommand("SELECT * INTO [Constituents] IN [csv://filename=c:/Constituents.csv;delimiter=tab] FROM [Constituents] WHERE Type = 'Home'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8479