Powershell - Invoke-SqlCmd, retrieving PRINT statements asynchronously
I would like to know if it开发者_运维百科s possibly to retrieve PRINT statements from a stored procedure asynchronously?
Currently the code below, only displays all the PRINT systems once the stored procedure has been executed.
"Invoke-Sqlcmd -ServerInstance $sql_server -Username $sql_usr -Password $sql_pwd -Database $sql_db -QueryTimeout 6000 -Query "EXEC TV.StoredProdure $cob_date, $region" -Verbose"
Any assistance will be greatly appreciated.
No.
PRINT
will only display once the command has completed, whether you run it from OSQL, SSMS, or Powershell.
What you CAN do is use RAISERROR
to get immediate feedback:
RAISERROR('This will display immediately',0,1) WITH NOWAIT
精彩评论