SQL Server (TSQL) - Is it possible to EXEC statements in parallel?

前端 未结 6 1536
自闭症患者
自闭症患者 2020-11-29 09:40

SQL Server 2008 R2

Here is a simplified example:

EXECUTE sp_executesql N\'PRINT \'\'1st \'\' + convert(varchar, getdate(), 126) WAITFOR DELAY \'\'000         


        
6条回答
  •  心在旅途
    2020-11-29 09:49

    If after reading all above about potential problems and you still want to run things in parallel, you probably can try sql jobs, put your queries in different jobs, then execute by calling the jobs like this

    EXEC msdb..sp_start_job 'Job1'
    
    EXEC msdb..sp_start_job 'Job2' 
    

提交回复
热议问题