Implementing extended stored procedures in SQL Server

Source: Internet
Author: User
Tags server error log

Obtain the version number of MS SQL

Execute master.. Sp_msgetversion

Get Hard Drive File information

Parameter Description: Directory name, directory depth, whether to display files

execute master..xp_dirtree 'c:'
execute master..xp_dirtree 'c:',1
execute master..xp_dirtree 'c:',1,1

List all OLE DB-provided programs installed on the server

Execute master.. Xp_enum_oledb_providers

List all code pages installed on the server

Execute master.. Xp_enumcodepages

List DSN configured on the server

Execute master.. Xp_enumdsn

Lists the SQL Server error log list, and then updates the time

Execute master.. Xp_enumerrorlogs

List all Windows local groups on the server

Execute master.. Xp_enumgroups

Detection of File existence

execute master..xp_fileexist 'c:\a.bak'
declare @flag int
exec master..xp_fileexist 'c:\abc.bak',@flag out
if @flag=1
begin
print 'exist'
end
else
begin
print 'no exist'
end

List the fixed drives on the server and the free space for each drive

Execute master.. Xp_fixeddrives

Get the computer name of the current SQL Server server

Execute master.. Xp_getnetname

List the details of the current error log

EXEC [Master]. [dbo]. [Xp_readerrorlog]

Lists all the next-level subdirectories of the specified directory

EXEC [Master]. [dbo]. [Xp_subdirs] ' C:\WINNT '

Lists the name of the drive--free space in bytes (low)

Drive Type: Floppy (1), Hard drive (2), CD-ROM (8)

EXEC [Master]. [dbo]. [Xp_availablemedia]

The effect is as follows:

name low free high free media type
C:\ 1270386688 0 2
D:\ 1726824448 2 2
E:\ 875053056 10 2
F:\ 0 0 8

There are also in [master]. [dbo]. [sp_addlogin] Inside has the encryption function Pwdencrypt, everybody is interested may try.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.