How can we help you today? How can we help you today?

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?
mildmanneredjon
0

Comments

2 comments

  • RBA
    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 @... nvarchar(2000)
    set @... = N'SELECT 1'
    create table #temp (dummy nvarchar(max))
    insert into #temp exec master..sp_executesql @...

    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,
    RBA
    0
  • mildmanneredjon
    Many thanks for the reply. This has resolved my problem.

    Jon.
    mildmanneredjon
    0

Add comment

Please sign in to leave a comment.