Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

OSQL leaving spid with sleeping status after each exec

$
0
0
Hi we have an ETL from one DB to another on the same server but we don't want to use SSIS and we want to exec all the ETL SP's at the same time for speed of the incremental loads currently about 60 SP's this is just in developement at this time on SQL 2014I have one file that we exec which runs fine and the load works and populates our exec monitoring table just fine :)But if I do sp_who2 on the box I see a sleeping spid for each of the SP's and every time I have run it so I get loads of sleeping SPID's My question is can I stop all the sleeping SP's am I missing a step in the code below or do I need to add some code to the SP that is being exec to stop this problem?Declare @RC intDECLARE @object intDECLARE @src varchar(255)DECLARE @desc varchar(255)EXEC @rc = sp_OACreate 'WScript.Shell', @object OUTIF @rc <> 0BEGIN EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT SELECT hr=convert(varbinary(4),@RC), Source=@src, Description=@desc RETURNEND-- -- Add the code from above here and comment out the old stuff EXEC @RC = sp_OAMethod @Object,'run',null,'osql -E -d DbName -S AZW-SQL-DEV-001 -q "exec dbo.Usp_Etl_Lfl_Rpt_Fact_WorkshopCapacityAndSpace"' IF @RC <> 0 BEGIN EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT SELECT convert(varbinary(4),@RC) as result, @src as [source], @desc as [error_description] RETURNEND

Viewing all articles
Browse latest Browse all 3145

Trending Articles