Run Backup without returning dataset

I'm wanting to run backups (EXECUTE master..sqlbackup ....) in SSMS but I do not want any datasets to be returned. I know you can omit the 2nd dataser by using the SINGLERESULTSET parameter but I also want to omit the first dataset. Is this possible?

Comments

  • RBARBA Posts: 152 Silver 3
    edited April 17, 2013 5:13AM
    Hi,

    Whilst I don't think SQL Backup doesn't have option to inhibit all result sets, you can hide its output by wrapping it in an sp_executesql command like so:

    declare @sql nvarchar(2000)
    set @sql = N'SELECT 1'
    create table #temp (dummy nvarchar(max))
    insert into #temp exec master..sp_executesql @sql

    Where 'select 1' is your backup command and the temporary table schema matches the output format of SQL Backup, which I think it a single column of nvarchar.

    Regards,
    Robin Anderson
    Development
    Red-Gate Software
  • Many thanks for the reply. This has resolved my problem.

    Jon.
Sign In or Register to comment.