Bella_Yu
8 months agoNew Contributor II
Bulk Load DataTable into External Database Table
I call a data adapter and store results in DataTable in below snippets. How can I bulk load OneStream data in this DataTable to external database table? External database connection is ready and working in below method.
Using dbConnApp As DbConnInfo = BRApi.Database.CreateExternalDbConnInfo(si, externalConnectinoName)
brapi.Database.ExecuteSql(dbConnApp, sqlQuery, False)
Using ds As DataSet = brapi.Dashboards.Process.GetAdoDataSetForAdapter(si, isSystemLevel, workspaceID, adapterName, resultsTableName, dctVars)
If ds.Tables.Count > 0 Then ' If there are >0 tables in the results
Using dt As DataTable = ds.Tables(0).Copy()
'Remove unsed columns
dt.Columns.Remove("Cube")
dt.Columns.Remove("TransformationRuleProfile")
For Each Col As DataColumn In dt.Columns
BRApi.ErrorLog.LogMessage(si, Col.ColumnName)
Next
Return dt
End Using
End If
End Using
Hi Bella_Yu
You can use this BRApi sub. There is a boolean variable we can pass in for Bulk Insert (datatable to sql table)