How to Use powershell to execute output of a Stored Procedur
by apriljuly at 2012-12-27 02:33:05
I wrote a stored procedure, the stored procedure can display some command to draw a report. Now I want to use powershell to execute each row of the output of the stored procedure.
I have a code like this
`$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server=T420s-JLI-W7;Database=AMSNewDataWarehouse;Integrated Security=True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = "YQBreport1"
$SqlCmd.Connection = $SqlConnection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
However it only list the output, instead of execute each row of the output. How can I let it execute each row of output?
An example of the output row is like
by Klaas at 2012-12-27 04:57:05
I don't understand what you want to do. In general, calling a stored procedure with Powershell lets SQL Database engine execute the SP.
You create reports by making an .rdl file in Visual Studio. This file is then deployed to Report Server.
Do you want to create the report definition with Powershell? Or do you want to draw those shapes somewhere outside Report Server?
You must be logged in to reply to this topic.