Cmdlets for Workday

Build 22.0.8397

SELECT INTO ステートメント

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

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

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

C#

String connectionString = "User=myuser;Password=mypassword;Tenant=mycompany;Host=https://wd3-impl-services1.workday.com";

using (WorkdayConnection connection = new WorkdayConnection(connectionString)) {
  WorkdayCommand cmd = new WorkdayCommand("SELECT Worker_Reference_WID, Legal_Name_Last_Name INTO [csv://[CData].[Human_Resources].Workers.txt] FROM [[CData].[Human_Resources].Workers] WHERE Legal_Name_Last_Name = 'Morgan' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "User=myuser;Password=mypassword;Tenant=mycompany;Host=https://wd3-impl-services1.workday.com" 

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

C#

String connectionString = "User=myuser;Password=mypassword;Tenant=mycompany;Host=https://wd3-impl-services1.workday.com";

using (WorkdayConnection connection = new WorkdayConnection(connectionString)) {
  WorkdayCommand cmd = new WorkdayCommand("SELECT * INTO [[CData].[Human_Resources].Workers] IN [csv://filename=c:/[CData].[Human_Resources].Workers.csv;delimiter=tab] FROM [[CData].[Human_Resources].Workers] WHERE Legal_Name_Last_Name = 'Morgan'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "User=myuser;Password=mypassword;Tenant=mycompany;Host=https://wd3-impl-services1.workday.com" 

Using connection As New WorkdayConnection(connectionString)
  Dim cmd As New WorkdayCommand("SELECT * INTO [[CData].[Human_Resources].Workers] IN [csv://filename=c:/[CData].[Human_Resources].Workers.csv;delimiter=tab] FROM [[CData].[Human_Resources].Workers] WHERE Legal_Name_Last_Name = 'Morgan'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

Copyright (c) 2022 CData Software, Inc. - All rights reserved.
Build 22.0.8397