在SQL Server中實現擴充預存程序

來源:互聯網
上載者:User

獲得MS SQL的版本號碼

execute master..sp_msgetversion

得到硬碟檔案資訊

參數說明:目錄名,目錄深度,是否顯示檔案

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

列出伺服器上安裝的所有OLEDB提供的程式

execute master..xp_enum_oledb_providers

列出伺服器上安裝的所有字碼頁

execute master..xp_enumcodepages

列出伺服器上配置的dsn

execute master..xp_enumdsn

列出sql server錯誤記錄檔列表,最後更新時間

execute master..xp_enumerrorlogs

列出伺服器上所有windows本機群組

execute master..xp_enumgroups

檢測檔案存在性

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

列出伺服器上固定磁碟機,以及每個磁碟機的可用空間

execute master..xp_fixeddrives

得到當前sql server伺服器的電腦名稱

execute master..xp_getnetname

列出當前錯誤記錄檔的具體內容

EXEC [master].[dbo].[xp_readerrorlog]

列出指定目錄的所有下一級子目錄

EXEC [master].[dbo].[xp_subdirs] 'c:\WINNT'

列出磁碟機的名稱 --以位元組為單位的空閑空間(low free)

以磁碟機類型:軟碟機(1),硬碟(2),cd-rom(8)

EXEC [master].[dbo].[xp_availablemedia]

效果如下:

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

還有在[master].[dbo].[sp_addlogin]裡面有加密函數pwdencrypt,大家感興趣可以試試。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.