How to get these information from TSQL?

ogrishmanogrishman Posts: 81 Bronze 4
edited July 24, 2012 10:52AM in SQL Backup Previous Versions
Hi,

I want to know how can I get these information from TSQL? Can I change them from TSQL?

r6VqT.png

Thanks[/img]

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    All of SQL Backup's server settings are kept in the registry, so you could use xp_regread. (Note that it may not work on 32-bit sql servers on a 64-bit system, because to work around a bug in MS clustering, SQL Backup keeps all settings in the 64-bit hive regardless).
    DECLARE @instanceName NVARCHAR(255)
    SELECT @instanceName=
    CASE
    WHEN @@SERVICENAME='MSSQLSERVER' THEN '(local)'
    WHEN @@SERVICENAME!='MSSQLSERVER' THEN @@SERVICENAME
    END
    DECLARE @SqlString NVARCHAR(500)
    SET @SqlString='EXEC xp_regread ''HKEY_LOCAL_MACHINE'',''SOFTWARE\Red Gate\SQL Backup\BackupSettingsGlobal\'+@instanceName+''',''DataPath'''
    EXECUTE(@SqlString)
    
    For the other settings, substitute one of these in the above code where you see DataPath:
    • MSDBDelete
    • BackupFileName
    • BackupFolder
    • LogFolder
    • LogDelete
    • LogDeleteOptions
Sign In or Register to comment.