Comments
2 comments
-
One option, using the SINGLERESULTSET option and a temporary table:IF OBJECT_ID('tempdb..#sqboutput') IS NOT NULLDROP TABLE #sqboutputCREATE TABLE #sqboutput (lines nvarchar(4000))DECLARE @cmd nvarchar(1024)SET @cmd = 'master..sqlbackup ''-sql "RESTORE DATABASE ... WITH ..., SINGLERESULTSET"'''INSERT INTO #sqboutput EXEC sp_executesql @cmdSELECT * FROM #sqboutputDROP TABLE #sqboutput
-
Thanx for the easy to use code !!!
Add comment
Please sign in to leave a comment.
Then we want to put the output from both the restore statement and the stored procedure in an email and send it to the department who requested the Restore
The output from the SP is no problem. But how to get the output from the restore ?
I only found:https://forum.red-gate.com/discussion/5237/sqlbackup-return-parameter
But this produce only the Number, not the whole Log Outcome.
Is there any way to do this?