sqlbackup return parameter???
edward0724
Posts: 3
How do I capture result return by redgate sql backup command - sqlbackup
I am doing something like this:
insert into #result
exec sqlback @backupdb
but I am getting insert error:
Insert Error: Column name or number of supplied values does not match table definition.
Can anyone tell me the how many column does the sqlbackup return and what are their datatype. or anything other way to do this.
Thanks in advance.
I am doing something like this:
insert into #result
exec sqlback @backupdb
but I am getting insert error:
Insert Error: Column name or number of supplied values does not match table definition.
Can anyone tell me the how many column does the sqlbackup return and what are their datatype. or anything other way to do this.
Thanks in advance.
Comments
When the SQL Backup statement is executed, you can extract them in the following way (where @var1 and @var2 are declared "int" variables):
execute master..sqlbackup '-SQL "BACKUP DATABASE [master] TO DISK = ''c:\temp\master.sqb'' WITH INIT"', @var1 OUTPUT, @var2 OUTPUT
If you wanted to use this with temporary tables, the definition you would need would be something like the following:
CREATE TABLE #temp (sqbexitcode int, sqlservercode int);
Unfortunately there is no easy/trivial way to capture the textual output from the extended stored procedure in 4.x, 5.0 or 5.1... but we will be introducing a new function for this in 5.2 so that this information can also be captured easily.
Hope that helps,
Jason
We're currently testing an option to omit the second result set, so that the output is similar to that produced in version 3. Stay tuned ...
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
SQL "Transact-SQL_statement" -U sa -U password -I instance
1) do we have a parameter that will write the output to a file
2)
will this be available on sql backup 5, if not when/which version
You can use the LOGTO option to save the log file in another folder, using your own naming convention.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8