How to get these information from TSQL?

Compresses, encrypts, secures and monitors SQL Server backups.

Moderators: JonathanWatts, Chris Auckland, eddie davis, Colin Millerchip, Brian Harris, james.billings, RBA, petey

How to get these information from TSQL?

Postby ogrishman » Tue Jul 24, 2012 2:37 pm

Hi,

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

Image

Thanks[/img]
ogrishman
 
Posts: 29
Joined: Mon Apr 12, 2010 8:21 pm

Postby Brian Donahue » Tue Jul 24, 2012 3:52 pm

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).
Code: Select all
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
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Backup 7

Who is online

Users browsing this forum: No registered users and 0 guests