How to include return code when using LiteSpeed via T-SQL script?
Declare the variable output type and include in script calling LiteSpeed procedures.
Example:
declare @rc int
exec @rc = master.dbo.xp_backup_database @database = 'Northwind'
, @filename = 'D:\backup\Northwind_Full.BKP'
, @backupname = 'Northwind backup'
, @desc = 'Backup of Northwind on 2007-08-06 15:43:25'
, @logging = 0
, @with = 'SKIP'
, @with = 'STATS = 10'
More complete information for failing scripts may be obtained by utilizing LiteSpeed logging 2 or 3. See LiteSpeed Help for additional detail.