February 3, 2015 at 9:57 am
On friday, I had a job interview and I was asked an interesting question. It was about querying and updating the registry using T-SQL. After the interview, I researched the question and found a possible answer using undocumented extended procedures.
The reason for this post is to ask you've ever used this or does it adds any value in real life to know this.
If possible, I like to avoid modifying the registry because I'm not knowledgeable enough to know how to do it by myself. But I wanted to know your opinion.
February 3, 2015 at 10:05 am
i don't update the registry, but i have a lot of admin scripts that do things like read the registry data/log/backup folders from the registry, so i can use them for the creation of backup jobs and other stuff, like the destination folder for CLR functions that write to disk.
the advantage is the registry functions are instance-specific, so on machines with multiple SQL instances, it helps enormously
it's a solid tool in the tool box.
EXECUTE [master].dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',
N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer',
N'BackupDirectory';
.
Lowell
February 3, 2015 at 10:31 am
That's good to know. As I'm basically a developer, I'm not used to work on admin tasks.
Thank you, Lowell.
February 3, 2015 at 10:42 am
I've read/written from/to the registry for certain crazy imports back in the days of the JET drivers. I also use it to read the default backup directory paths that Lowell identified.
As a bit of a sidebar, I think that such questions should not be asked during a Developer Interview for obvious reasons.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 3, 2015 at 10:57 am
I have had to read from the registry when creating DTS (back in the day) and SSIS packages. Some app developers like to store information about that custom app in the registry.
That does seem like a "out of left-field" kind of question. My experience has been that when people ask these kind of questions it's because it's something that they are doing there.
-- Itzik Ben-Gan 2001
February 3, 2015 at 10:59 am
Jeff Moden (2/3/2015)
I think that such questions should not be asked during a Developer Interview for obvious reasons.
+10
I too have queried the registry for various things via tsql.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
February 3, 2015 at 11:18 am
Lowell (2/3/2015)
i don't update the registry, but i have a lot of admin scripts that do things like read the registry data/log/backup folders from the registry, so i can use them for the creation of backup jobs and other stuff, like the destination folder for CLR functions that write to disk.the advantage is the registry functions are instance-specific, so on machines with multiple SQL instances, it helps enormously
it's a solid tool in the tool box.
EXECUTE [master].dbo.xp_instance_regread N'HKEY_LOCAL_MACHINE',
N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer',
N'BackupDirectory';
.
Yep, this. Although I think that info is now available in DMV's for newer versions of SQL (2012+ ?)
February 3, 2015 at 11:35 am
Gazareth (2/3/2015)
Yep, this. Although I think that info is now available in DMV's for newer versions of SQL (2012+ ?)
oh, i wish i was running pure 2012 and above...that would be sweet. I need to review some of the new stuff in the dmv's , thanks for the pointer!
I'm happy i retired my last SQL2000 server last year (well the hardware under it died, so it kind of self retired and came off of my responsbilities list)
my shop has most servers are running 2008R2, so scripts that need those directories will be using the xp's for the forseeable future. i have a few 2005's and a few 2012's, and a pair of SQL2014 (one production/ one Dev )
Lowell
February 4, 2015 at 3:35 am
Lowell (2/3/2015)
Gazareth (2/3/2015)
Yep, this. Although I think that info is now available in DMV's for newer versions of SQL (2012+ ?)oh, i wish i was running pure 2012 and above...that would be sweet. I need to review some of the new stuff in the dmv's , thanks for the pointer!
I'm happy i retired my last SQL2000 server last year (well the hardware under it died, so it kind of self retired and came off of my responsbilities list)
my shop has most servers are running 2008R2, so scripts that need those directories will be using the xp's for the forseeable future. i have a few 2005's and a few 2012's, and a pair of SQL2014 (one production/ one Dev )
Hmm, think I'm a victim of my own wishful thinking here... seems reading the registry is still required in 2012/2014.
Although it can be found via SMO if you're going that way.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply