user983965
user983965

Reputation: 1121

Powershell - Invoke-SqlCmd, retrieving PRINT statements asynchronously

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.

Upvotes: 1

Views: 1674

Answers (1)

JNK
JNK

Reputation: 65197

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

Upvotes: 4

Related Questions