The SQL stored procedure runs a command from the database to run the powershell script.
DECLARE @return_value int, @ReturnValue varchar(max) EXEC @return_value = dbo.sp_runBatchFile @ReturnValue = @ReturnValue OUTPUT SELECT @ReturnValue as N'@ReturnValue' SELECT 'RESULT' = @return_value GO As a result, the script returns the data and we get the output as a table:
How to get the value from the 3rd line to assign it to the 'RESULT'?