Can I capture the version of SQLBackup being used via t-sql?

jim.wilsonjim.wilson Posts: 8
edited October 8, 2007 12:44PM in SQL Backup Previous Versions
I'd like to report SQLBackup version information for all SQL servers to a central SQL server via a nightly automated process throughout our SQL environment. To do this, I need to be able to somehow capture the SQLBackup version info using t-sql (e.g. SQL Backup v5.1.0.2781). I'm guessing this might be possible using the extended sproc sqbutility, but I have no idea what parameters would be used. Any ideas or suggestions?

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Jim,

    You can... Hopefully this information doesn't change as it's undocumented!
    declare @CurrentSQBVersion NVARCHAR(50)
    execute master..sqbutility 1030, @CurrentSQBVersion OUTPUT
    SELECT @CurrentSQBVersion As [SQB Version]
    
    The version is returned in @CurrentSQBVersion.
  • Perfect. Thank you.
  • I need to eliminate a result set from your code. Below returns empty result set from call to sqbutility, and since I am not super VB programmer, I don't know how to get around that.

    Can I get it to not return empty result set?
    DECLARE
    	@CurrentSQBVersion 	NVARCHAR(50) 
    
    BEGIN
    	SET NOCOUNT ON
    	
    	EXECUTE master..sqbutility 1030, @CurrentSQBVersion OUTPUT 
    
    	SELECT @CurrentSQBVersion AS [RedGate_Version] 
    	/*  The version is returned in @CurrentSQBVersion. */
    
    END
    

    results
    result
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    RedGate_Version
    --------------------------------------------------
    4.6.0.815
    
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    It may not be the best solution, but this seems to work:
    declare @CurrentSQBVersion NVARCHAR(50) 
    CREATE TABLE #temp (
    trash CHAR(1)
    )
    INSERT #temp EXEC master..sqbutility 1030, @CurrentSQBVersion OUTPUT
    SELECT @CurrentSQBVersion As [SQB Version]
    DROP TABLE #temp
    
  • Brian,
    I thought about trying this but hadn't done it. This solution works. Thanks for feedback.
Sign In or Register to comment.