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

前端 未结 6 1537
自闭症患者
自闭症患者 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:59

    Yes, there is a way, see Asynchronous procedure execution.

    However, chances are this is not what you need. T-SQL is a data access language, and when you take into consideration transactions, locking and commit/rollback semantics is almost impossible to have a parallel job. Parallel T-SQL works for instance with requests queues, where each requests is independent and there is no correlation between jobs.

    What you describe doesn't sound at all like something that can, nor should, actually be paralellized.

提交回复
热议问题