Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Data Management

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

Authors

Search

XML Feeds

Google Ads

« Beginning stages of a DR plan for SQL ServerBack to business for the SQL Server community »
comments
Rate Post:
submit to reddit Digg!FacebookDotnetkicks

When you use an undocumented stored procedure, you run the risk of not being able to upgrade your database to a new version. What's worse... you could have broken functionality and not even know it. With undocumented stored procedures, Microsoft may not document when they decide to deprecate it, so you may not know about your broken functionality until it's too late.

Presented below is a hard coded list of undocumented stored procedures. By their very nature, it is hard to find documentation on undocumented procedures. Therefore, the procedures in the list below is likely to be incomplete.

How to detect this problem:

  1. DECLARE @Temp TABLE(ProcedureName VARCHAR(50))
  2.  
  3. INSERT INTO @Temp VALUES('sp_MStablespace')
  4. INSERT INTO @Temp VALUES('sp_who2')
  5. INSERT INTO @Temp VALUES('sp_tempdbspace')
  6. INSERT INTO @Temp VALUES('sp_MSkilldb')
  7. INSERT INTO @Temp VALUES('sp_MSindexspace')
  8. INSERT INTO @Temp VALUES('sp_MShelptype')
  9. INSERT INTO @Temp VALUES('sp_MShelpindex')
  10. INSERT INTO @Temp VALUES('sp_MShelpcolumns')
  11. INSERT INTO @Temp VALUES('sp_MSforeachtable')
  12. INSERT INTO @Temp VALUES('sp_MSforeachdb')
  13. INSERT INTO @Temp VALUES('sp_fixindex')
  14. INSERT INTO @Temp VALUES('sp_columns_rowset')
  15. INSERT INTO @Temp VALUES('sp_MScheck_uid_owns_anything')
  16. INSERT INTO @Temp VALUES('sp_MSgettools_path')
  17. INSERT INTO @Temp VALUES('sp_gettypestring')
  18. INSERT INTO @Temp VALUES('sp_MSdrop_object')
  19. INSERT INTO @Temp VALUES('sp_MSget_qualified_name')
  20. INSERT INTO @Temp VALUES('sp_MSgetversion')
  21. INSERT INTO @Temp VALUES('xp_dirtree')
  22. INSERT INTO @Temp VALUES('xp_subdirs')
  23. INSERT INTO @Temp VALUES('xp_enum_oledb_providers')
  24. INSERT INTO @Temp VALUES('xp_enumcodepages')
  25. INSERT INTO @Temp VALUES('xp_enumdsn')
  26. INSERT INTO @Temp VALUES('xp_enumerrorlogs')
  27. INSERT INTO @Temp VALUES('xp_enumgroups')
  28. INSERT INTO @Temp VALUES('xp_fileexist')
  29. INSERT INTO @Temp VALUES('xp_fixeddrives')
  30. INSERT INTO @Temp VALUES('xp_getnetname')
  31. INSERT INTO @Temp VALUES('xp_readerrorlog')
  32. INSERT INTO @Temp VALUES('sp_msdependencies')
  33. INSERT INTO @Temp VALUES('xp_qv')
  34. INSERT INTO @Temp VALUES('xp_delete_file')
  35. INSERT INTO @Temp VALUES('sp_checknames')
  36. INSERT INTO @Temp VALUES('sp_enumoledbdatasources')
  37. INSERT INTO @Temp VALUES('sp_MS_marksystemobject')
  38. INSERT INTO @Temp VALUES('sp_MSaddguidcolumn')
  39. INSERT INTO @Temp VALUES('sp_MSaddguidindex')
  40. INSERT INTO @Temp VALUES('sp_MSaddlogin_implicit_ntlogin')
  41. INSERT INTO @Temp VALUES('sp_MSadduser_implicit_ntlogin')
  42. INSERT INTO @Temp VALUES('sp_MSdbuseraccess')
  43. INSERT INTO @Temp VALUES('sp_MSdbuserpriv')
  44. INSERT INTO @Temp VALUES('sp_MSloginmappings')
  45. INSERT INTO @Temp VALUES('sp_MStablekeys')
  46. INSERT INTO @Temp VALUES('sp_MStablerefs')
  47. INSERT INTO @Temp VALUES('sp_MSuniquetempname')
  48. INSERT INTO @Temp VALUES('sp_MSuniqueobjectname')
  49. INSERT INTO @Temp VALUES('sp_MSuniquecolname')
  50. INSERT INTO @Temp VALUES('sp_MSuniquename')
  51. INSERT INTO @Temp VALUES('sp_MSunc_to_drive')
  52. INSERT INTO @Temp VALUES('sp_MSis_pk_col')
  53. INSERT INTO @Temp VALUES('xp_get_MAPI_default_profile')
  54. INSERT INTO @Temp VALUES('xp_get_MAPI_profiles')
  55. INSERT INTO @Temp VALUES('xp_regdeletekey')
  56. INSERT INTO @Temp VALUES('xp_regdeletevalue')
  57. INSERT INTO @Temp VALUES('xp_regread')
  58. INSERT INTO @Temp VALUES('xp_regenumvalues')
  59. INSERT INTO @Temp VALUES('xp_regaddmultistring')
  60. INSERT INTO @Temp VALUES('xp_regremovemultistring')
  61. INSERT INTO @Temp VALUES('xp_regwrite')
  62. INSERT INTO @Temp VALUES('xp_varbintohexstr')
  63. INSERT INTO @Temp VALUES('sp_MSguidtostr')
  64.  
  65. SELECT DISTINCT Name
  66. FROM   sysobjects
  67.        INNER Join @Temp T
  68.          ON Object_Definition(id) Like '%' + T.ProcedureName + '%'     
  69. WHERE  XType = 'P'
  70.        And OBJECTPROPERTY(ID, N'IsMSShipped') = 0
  71. ORDER BY Name

How to correct it: Rewrite your functionality so that is does not rely upon undocumented procedures.

Level of severity: moderate to high

Level of difficulty: moderate to high. Undocumented stored procedures are often used because it's easy. Replacing it is usually NOT easy.

About the Author

George has been developing software professionally for 19 years, first for the department of defense, and then for various other companies. In 1998, George started his software company, Orbit Software, specializing in School Bus Transportation software. His specialty is refining SQL Server queries to deliver optimal performance.
Social SitingsTwitterLTD RSS Feed
359 views
submit to reddit Digg!FacebookDotnetkicks

Comments and Feedback

13 comments

Comment from: Aaron Bertrand [Visitor] · http://sqlblog.com/blogs/aaron_bertrand/
Here are more:

xp_qv
xp_delete_file

I'd also be curious to see which MS-shipped stored procedures use undocumented stuff, so I would take out the OBJECTPROPERTY clause in that case... not that *I* need to worry about them breaking, since the procs should be fixed by MS during an upgrade if the procs they call have breaking changes. But just for the curiosity factor.
11/13/09 @ 07:45
Comment from: George Mastros [Member] Email
Thanks Aaron. I added those 2 undocumented procedures to the list.

Does anyone else know of other undocumented procedures that should be included in this list?
11/13/09 @ 07:54
Comment from: SQLDenis [Member] Email
Here are 7 more George


sp_checknames
sp_enumoledbdatasources
sp_MS_marksystemobject
sp_MSaddguidcolumn
sp_MSaddguidindex
sp_MSaddlogin_implicit_ntlogin
sp_MSadduser_implicit_ntlogin
11/13/09 @ 08:03
Comment from: George Mastros [Member] Email
Thanks Denis.
11/13/09 @ 08:08
Comment from: SQLDenis [Member] Email
You listed sp_MStablespace twice :-)
11/13/09 @ 08:09
Comment from: SQLDenis [Member] Email
And here are another 5 for you :-)


sp_MSdbuseraccess
sp_MSdbuserpriv
sp_MSloginmappings
sp_MStablekeys
sp_MStablerefs
11/13/09 @ 08:10
Comment from: SQLDenis [Member] Email
and just because I can :-) here are 5 more

sp_MSuniquetempname
sp_MSuniqueobjectname
sp_MSuniquecolname
sp_MSuniquename
sp_MSunc_to_drive
11/13/09 @ 08:13
Comment from: SQLDenis [Member] Email
Okay after this I WILL stop, 9 more

xp_get_MAPI_default_profile
xp_get_MAPI_profiles

xp_regdeletekey
xp_regdeletevalue
xp_regread
xp_regenumvalues
xp_regaddmultistring
xp_regremovemultistring
xp_regwrite
11/13/09 @ 08:31
Comment from: Naomi [Member] Email
sp_makewebtask
11/17/09 @ 07:32
Comment from: SQLDenis [Member] Email
Naomi,

sp_makewebtask is in books on line

http://msdn.microsoft.com/en-us/library/aa238843%28SQL.80%29.aspx

as well as sp_runwebtask
11/17/09 @ 10:16
Comment from: Naomi [Member] Email
But it's deprecated, as I understood. In other words, even documented SPs may become deprecated.
11/17/09 @ 11:45
Comment from: Naomi [Member] Email
Check this article http://www.sqlservercentral.com/articles/Stored+Procedures/62868/ on the same topic. You may link to it in your blog.
11/20/09 @ 05:58
Comment from: Naomi [Member] Email
What will you use instead of xp_fixeddrives ?
12/28/09 @ 09:52

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)