Working with the Registry

  • Dinesh Asanka

    SSChampion

    Points: 11058

    Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/dasanka/w




    My Blog: http://dineshasanka.spaces.live.com/

  • msurasky

    Mr or Mrs. 500

    Points: 595

    Great article Dinesh!

    I agree with you that accessing registry keys from SQL Server scripts/stored procedures is not something that you will do often, but is great to know that you actually "can" do it if you want.

    I think that maybe this extended stored procedures can be useful as a good alternative to logged operations (compared to logging in the event log or somewhere else) or to keep configuration information in the registry (buffer size for cursors, type of locking, or whatever you can think of) by pointing your sp's to read to a particular registry. Then, if you want to try your sp's with different configurations you don't have to modify all of them, simply change that registry key...

    Other ideas would be to keep on the registry the name of files where your stored procedures will write debugging information. Then, if you decide to move your debugging files somewhere else, just change the registry.

    The Isn't weird?... you can even change the desktop background from a stored procedure!.. the limits of the registry key are endless if you know how to use it...

    Thanks!

  • samm2425

    SSC Veteran

    Points: 209

    awesome article

    gr8 way for getting values out of the registry.

    Thanks.

  • Dinesh Asanka

    SSChampion

    Points: 11058

    Thankx all .but credit should also goes to Frank Kalis as well.




    My Blog: http://dineshasanka.spaces.live.com/

  • Frank Kalis

    SSC Guru

    Points: 111183

    Thanks Dinesh!

    There is just one thing I like to add.

    All of these procedures are undocumented and subject to change anytime at Microsoft's will. I would really carefully think about this BEFORE writing production code with these procedures.

    Nonetheless I agree it's good to know that there is a way, but then again there are also many other ways. I would prefer doing this in the application layer.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Dinesh Asanka

    SSChampion

    Points: 11058

    Yes Frank,

    I fully agree with you.

    Yes I has to be used as the LAST OPTION. Sorry I didn't mention that in my article.

     




    My Blog: http://dineshasanka.spaces.live.com/

  • Frank Kalis

    SSC Guru

    Points: 111183

    Please don't get me wrong. My reply wasn't meant to be criticism, but rather calling attention on this nasty side-effect of using something undocumented.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • Dinesh Asanka

    SSChampion

    Points: 11058

    No Frank. It is no criticism but it is a fact




    My Blog: http://dineshasanka.spaces.live.com/

  • Dinesh Asanka

    SSChampion

    Points: 11058

    Thankx all for your comments which help me lot




    My Blog: http://dineshasanka.spaces.live.com/

  • JT Lovell

    Ten Centuries

    Points: 1158

    Great article, thanks for sharing it!  It's probably important to point out that it is the server's registry that is being used, rather than the client's.

     

  • Ramesh Saive

    SSC-Insane

    Points: 24275

    Its a great article and thanks for sharing it...

    I wonder, is there's any way of knowing the existence of a key before reading it?

    --Ramesh


Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply