Forum Discussion
H2Apps
Apr 13, 2021Copper Contributor
Removing any output from BACKUP operation on SQL Server
Hello, Apparently there is no way to remove the output produced by the BACKUP command. You can use the trace flag 3226 to remove the writing to the SQL Server's log file, and use the option WITH S...
HarshKumar994
Feb 18, 2023Brass Contributor
There is no built-in option to suppress the backup completion message entirely in SQL Server. However, you can redirect the output of the backup command to a text file or a null device to prevent the messages from being displayed on the console output.
Here is the query you can try.
BACKUP DATABASE myDB
TO DISK = 'C:\Backup\myDB.bak'
WITH INIT, SKIP, STATS = 100
> C:\Backup\BackupLog.txt
This command backs up the "myDB" database to the "C:\Backup\myDB.bak" file, skips any existing backup sets, generates progress messages every 100 percent, and redirects the output to a text file named "BackupLog.txt" in the "C:\Backup" folder.
Note that the > symbol is used to redirect the output to a file. If the file already exists, the new output will be appended to the end of the file. If you want to overwrite the file each time the command runs, you can use >> instead of >like below.
BACKUP DATABASE myDB
TO DISK = 'C:\Backup\myDB.bak'
WITH INIT, SKIP, STATS = 100
>> C:\Backup\BackupLog.txt
Here is the query you can try.
BACKUP DATABASE myDB
TO DISK = 'C:\Backup\myDB.bak'
WITH INIT, SKIP, STATS = 100
> C:\Backup\BackupLog.txt
This command backs up the "myDB" database to the "C:\Backup\myDB.bak" file, skips any existing backup sets, generates progress messages every 100 percent, and redirects the output to a text file named "BackupLog.txt" in the "C:\Backup" folder.
Note that the > symbol is used to redirect the output to a file. If the file already exists, the new output will be appended to the end of the file. If you want to overwrite the file each time the command runs, you can use >> instead of >like below.
BACKUP DATABASE myDB
TO DISK = 'C:\Backup\myDB.bak'
WITH INIT, SKIP, STATS = 100
>> C:\Backup\BackupLog.txt