In SQL Server, there are not many opportunities to extend the storage process for direct use.
I have summarized several useful extended stored procedures as follows:
-- Obtain the version number of MS SQL
Execute master .. sp_msgetversion
Go
-- The effect is as follows:
Character_value
------------------------------------------
8.00.760 1 3
(The number of affected rows is 1)
-- Obtain the hard disk file information
-- Parameter description: directory name, directory depth, and whether to display files
Execute master .. xp_dirtree 'C :'
Go
Execute master .. xp_dirtree 'C: ', 1
Go
Execute master .. xp_dirtree 'C: ', 1, 1
Go
-- List all provided by oledb installed on the serverProgram
Execute master .. xp_enum_oledb_providers
Go
-- List all installed on the serverCodePage
Execute master .. xp_enumcodepages
Go
-- List the DSN configured on the server
Execute master .. xp_enumdsn
Go
-- List the SQL server error logs and the last update time
Execute master .. xp_enumerrorlogs
Go
-- List all Windows Local Groups on the server
Execute master .. xp_enumgroups
Go
-- Check file existence
Execute master .. xp_fileexist 'C: \ A. Bak'
Go
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
Go
-- List the fixed drives on the server and the available space for each drive
Execute master .. xp_fixeddrives
Go
-- Obtain the computer name of the current SQL Server server.
Execute master .. xp_getnetname
Go
-- List the specific content of the current Error Log
Exec [Master]. [DBO]. [xp_readerrorlog]
Go
-- List all sub-directories under a specified directory
Exec [Master]. [DBO]. [xp_subdirs] 'C: \ WINNT'
Go
--- List drive names
-- Low free space in bytes)
-- Drive type: Hard Drive (1), Hard Drive (2), CD-Rom (8)
Exec [Master]. [DBO]. [xp_availablemedia]
Go
-- 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
(The number of affected rows is 4)
The [Master]. [DBO]. [sp_addlogin] contains the encryption function pwdencrypt. If you are interested, try again.
I hope the Knowledge mentioned above will prompt you.
Of course, you are welcome to contact us and correct us.
Author: aierong
Blog: http://www.cnblogs.com/aierong
Email: aierong@126.com