Red Gate forums :: View topic - How to get these information from TSQL?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Backup 7
SQL Backup 7 forum

How to get these information from TSQL?

Search in SQL Backup 7 forum
Post new topic   Reply to topic
Jump to:  
Author Message
ogrishman



Joined: 12 Apr 2010
Posts: 29

PostPosted: Tue Jul 24, 2012 2:37 pm    Post subject: How to get these information from TSQL? Reply with quote

Hi,

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



Thanks[/img]
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6677

PostPosted: Tue Jul 24, 2012 3:52 pm    Post subject: Reply with quote

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:
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
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group