Flash Tip: Believe It When Microsoft Tells You Not to Use Undocumented Functions
By Brian Moran
Q: Why does Microsoft recommend not using undocumented functions in SQL Server?
A: Microsoft SQL Server has always had nifty undocumented functions that are tempting to use. However, Microsoft has always recommended not using those functions because they can change in future releases. For the most part, Microsoft hasn't changed undocumented behavior in a way that would cause problems if you had been sneaky and used some of the hidden features. Now, though, SQL Server 2000 Service Pack 4 (SP4) adds limitations on what you can do with the undocumented, extended stored procedures xp_regread and xp_regwrite. Perform an Internet search for xp_regread or xp_regwrite and you'll find dozens of sites that will teach you how to use those procedures to read from and write to the registry. Starting in SP4, these procedures will work with only SQL Server's registry keys.
I'm sure there are many people using these extended procedures who won't be pleased with the change, but we were warned. Historically, SQL Server users could get away with ignoring the don't-use-an-undocumented-feature rule. Using the features rarely burned us. Now, we'll have to change our way of thinking and stop using undocumented and unsupported features in our production code.
This SQL Server tip is brought to you by SQL Server Magazine. Subscribe today and get all the SQL Server answers you need. As an added bonus, you will save 44 percent off the cover price and get the latest Top SQL Server Tips guide free with your paid order. Act now—this is a limited-time offer.