Site sponsored by:
Try Idera’s new SQL admin toolset
Home
Articles
Forums
Tips
Quiz
FAQ's
Blogs
Software
Books
About Us
RSS Feeds
Sign in
|
Join
Article Topics
All Articles
Peformance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET
SQL Server 2008 - Worth the Wait
SQL Server’s first significant upgrade in three years features a number of envelope-pushing enhancements and improvements. Which will have the greatest impact on SQL administration and development?
More...
Latest Articles
Slowly Changing Dimensions in SQL Server 2005
Audit Data Modifications
SQL Server 2008’s Management Data Warehouse
Same Report but Different Methods in SQL Server Reporting Services ...
More
Latest FAQ's
How to Integrate Performance Monitor and SQL Profiler
SSIS Lookups are Case Sensitive
Convert Number to Words in SSRS
After installing SP2 on SQL Server 2005 x64, when trying to ...
More
Latest Software Reviews
SQL Server DBA Dashboard
SwisSQL DBChangeManager
SQLMesh - SQL Server Search Tool
SoftTreeTech SQL Assistant
More
articles
>>
developer
>>
Useful Undocumented SQL Server Extended Stored Procedures ...
Useful Undocumented SQL Server Extended Stored Procedures
By :
Alexander Chigrik
May 22, 2001
Printer friendly
An extended stored procedure (xp) is a dynamic link library that runs directly in the address space of SQL Server and is programmed using the SQL Server Open Data Services API. You can run extended stored procedures from the Query Analyzer, for example, just as you would normal stored procedures. Extended stored procedures are used to extend the capabilities of SQL Server. You can take advantage of the many extended stored procedures that come with SQL Server, or you can can write your own in a programming language such as C or C++.
In this article, I want to tell you about some useful
undocumented
extended stored procedures. These extended stored procedures work with SQL Server 7.0, as well as with SQL Server 2000.
sp_MSgetversion
This extended stored procedure can be used to get the current version of Microsoft SQL Server. To get the current SQL Server version, run:
EXEC master..sp_MSgetversion
Note. A more common way to retrieve the current SQL Server version (this way provides more information) is to use following SELECT statement:
SELECT @@version
xp_dirtree
This extended stored procedure can be used to get a list of all the folders for the folder named in the xp. To get a list of all the folders in the C:\MSSQL7 folder, run:
EXEC master..xp_dirtree 'C:\MSSQL7'
xp_subdirs
This extended stored procedure is used to get the list of folders for the folder named in the xp. In comparison with xp_dirtree, xp_subdirs returns only those directories whose depth = 1.
This is the example:
EXEC master..xp_subdirs 'C:\MSSQL7'
xp_enum_oledb_providers
This extended stored procedure is used to list of all the available OLE DB providers. It returns Provider Name, Parse Name and Provider Description. To get a list of all OLE DB providers for your SQL Server, run:
EXEC master..xp_enum_oledb_providers
xp_enumcodepages
This extended stored procedure can be used to list of all code pages, character sets and their description for your SQL Server. To see this, list, run:
EXEC master..xp_enumcodepages
xp_enumdsn
This extended stored procedure returns a list of all system DSNs and their descriptions. To get the list of system DSNs, run:
EXEC master..xp_enumdsn
xp_enumerrorlogs
This extended stored procedure returns the list of all error logs with their last change date. To get the list of error logs, run:
EXEC master..xp_enumerrorlogs
xp_enumgroups
This extended stored procedure returns the list of Windows NT groups and their description. To get the list of the Windows NT groups, run:
EXEC master..xp_enumgroups
xp_fileexist
You can use this extended stored procedure to determine whether a particular file exists on the disk or not. The syntax for this xp is:
EXECUTE xp_fileexist filename [, file_exists INT OUTPUT]
For example, to check whether the file boot.ini exists on disk c: or not, run:
EXEC master..xp_fileexist 'c:\boot.ini'
xp_fixeddrives
This very useful extended stored procedure returns the list of all hard drives and the amount of free space in Mb for each hard drive. To see the list of drives, run:
EXEC master..xp_fixeddrives
xp_getnetname
This extended stored procedure returns the WINS name of the SQL Server that you're connected to. To view the name, run:
EXEC master..xp_getnetname
xp_readerrorlog
This extended stored procedure returns the content of the errorlog file. You can find the errorlog file in the C:\MSSQL7\Log directory, by default. To see the text of the errorlog file, run:
EXEC master..xp_readerrorlog
Next Page>>
Home
|
Peformance Articles
|
Audit Articles
|
Business Intelligence Articles
|
Clustering Articles
|
Developer Articles
|
Reporting Services Articles
|
DBA Articles
|
ASP.NET / ADO.NET Articles
|
DBA FAQ's
|
Developer Peformance FAQ's
|
DBA Peformance FAQ's
|
Developer FAQ's
|
Clustering FAQ's
|
Error Messages
|
Audit Tool Reviews
|
Backup Tool Reviews
|
Coding Tool Reviews
|
Compare Tool Reviews
|
Documentation Tool Reviews
|
Design Tool Reviews
|
Monitoring Tool Reviews
|
Log Tool Reviews
|
Reporting Tool Reviews
|
Clustering Tool Reviews
|
Security Tool Reviews
|
Change Management Tool Reviews
|
Remote Access Tool Reviews
|
Book Reviews
|
Security Tool Reviews
|
QDPMA Performance Tuning
|
ADO.NET / ASP.NET
|
Administration
|
Analysis/OLAP Services
|
Application Development
|
Configuration
|
Components
|
ETL
|
Hardware
|
High Availability
|
Hints
|
Index
|
Misc
|
Operating Systems
|
Performance Tuning
|
Replication
|
T-SQL
|
Views