Hi,
I have one more question about PowerShell.
I have this code to execute a stored procedure.
$SqlSourceConnection.Open()
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = "EXECUTE dbo.MyStoredProcedure"
$SqlCmd.Connection = $SqlSourceConnection
$SqlCmd.CommandTimeout = 30
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$Data = New-Object System.Data.DataSet
$SqlAdapter.Fill($Data)
$SqlSourceConnection.Close()
$Data.Tables[0]
Now I would like to add two columns (server name and timestamp) to the resultset in PowerShell, and then write the result to a table on another server. (I cannot modify the stored procedure.)
What method would you recommend to do this? All feedback is greatly appreciated.
Best regards
Ola Hallengren
http://ola.hallengren.com
I have one more question about PowerShell.
I have this code to execute a stored procedure.
$SqlSourceConnection.Open()
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = "EXECUTE dbo.MyStoredProcedure"
$SqlCmd.Connection = $SqlSourceConnection
$SqlCmd.CommandTimeout = 30
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$Data = New-Object System.Data.DataSet
$SqlAdapter.Fill($Data)
$SqlSourceConnection.Close()
$Data.Tables[0]
Now I would like to add two columns (server name and timestamp) to the resultset in PowerShell, and then write the result to a table on another server. (I cannot modify the stored procedure.)
What method would you recommend to do this? All feedback is greatly appreciated.
Best regards
Ola Hallengren
http://ola.hallengren.com