Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

SQL stored procedure execution takes 5x as long using PS 3.0

$
0
0

I have a stored procedure that populates some reporting table, does not return any results, and is very expensive.  However it completes in 5 minutes when executed using SSMS.  When the same stored procedure is executed though PS 3.0 it runs in almost 25 minutes.  The condensed code is shown below.  The $Connection is defined elsewhere and is already open at this point.

$Command = New-Object Data.OleDb.OleDbCommand
$Command.CommandTimeout = 600
$Command.CommandText = "dbo.usp_extract_exact_target_user @in_all_flg = 1"
$Command.Connection = $Connection
$Command.ExecuteNonQuery()

Can anyone tell me where I'm going wrong, or what could be causing the 5x execution times?

Thanks in advance for help; you can offer.



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>