I would like to know if its 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.
PRINTwill only display once the command has completed, whether you run it from OSQL, SSMS, or Powershell.What you CAN do is use
RAISERRORto get immediate feedback:RAISERROR('This will display immediately',0,1) WITH NOWAIT