| Author |
Message |
ogrishman
Joined: 12 Apr 2010 Posts: 20
|
Posted: Tue Jul 24, 2012 2:37 pm Post subject: How to get these information from TSQL? |
|
|
Hi,
I want to know how can I get these information from TSQL? Can I change them from TSQL?
Thanks[/img] |
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6369 Location: Red Gate Software
|
Posted: Tue Jul 24, 2012 3:52 pm Post subject: |
|
|
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
_________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
|
|
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