sql伺服器內部參數使用詳情(預存程序)

來源:互聯網
上載者:User

標籤:

exec sp_help;返回當前資料庫中的所有預存程序。
exec sp_help datebase.dbo.table名稱 返回當前表中的所有對象。如欄位名稱等。這個吊
exec sp_helpfile 返回當前資料庫檔案的實體名稱以及屬性。查看當前資料的所有資料庫檔案屬性
exec sp_helpfile ’檔案夾名‘ 查看資料庫檔案Northwind_data的屬性
exec sp_helpindex [表名] 返回表中的所有索引資訊
sp_helptext 查看對象內容資訊
sp_helptrigger 查看觸發器資訊
sp_helptrigger products 返回表中的所有dml (增刪改)觸發資訊
sp_helptrigger products ,‘insert‘ 返回產品表下所有insert 觸發器的資訊
sp_who 顯示當前所有使用者和進程的資訊
sp_who sa 顯示sa目前使用者的進程資訊
sp_columns 查看列資訊
@table_name 返回目錄資訊的表或視圖的名稱
@table_owner 返回目錄資訊的表或視圖的對象所有者
@table_qualifier 表或視圖限定符的名稱
@column_name 一個單獨列 當只要目錄的列時可以使用該參數
列入:exec sp_columms produces, @column_name=productName; 返回產品表中列名位“產品名稱”的資訊
sp_databases 用於顯示資料庫資訊包括資料庫名稱和資料 庫大小 該預存程序沒有參數
sp_fkeys 查看外鍵資訊
@pktable_name 帶主鍵的表的名稱,用於返回目錄資訊
@pktable_owner 表(帶主鍵)的所有者的名稱,用於返回目錄資訊
@pktable_qualifier 錶帶主鍵限定符的名稱
@fktable_name 用於返回目錄資訊的錶帶外鍵的名稱
@fktable_owner 用於返回目錄資訊的錶帶外鍵的所有者的名稱
@fktable_qualifier 錶帶外鍵限定符的名稱

sp_pkeys 查看主鍵資訊
@table_name
@table_owner
@table_qualifier

sp_server_info 查看sqlserver資訊

sp_tables 查看錶或視圖資訊
@table_name 用來返回目錄資訊的表
@table_owner 用於返回目錄資訊的表的所有者
@table_qualifier 表限定符的名稱
@table_type 由逗號分割的值列表,提供有關所有制定表類型的表資訊
@fUsePattern 確定是否將底線,百分比符號 或方括弧 解釋為萬用字元
例子:
exec sp_tables @table_type="‘dbo.Login‘"

 

sp_stroed_procedures 查看預存程序資訊
@sp_name 用於返回目錄資訊的過程名
@sp_owner 該過程所屬架構
@qualifier 過程限定符的名稱
@fUsePattern 確定是否將底線,百分比符號 或方括弧 解釋為萬用字元

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

create procedure proc_2
@return_var int output
as
begin
select @return_var=sum(LoginId)from Praise
end
go

declare @acept_var int
exec proc_2 @acept_var output
print @acept_var
go

create procedure proc_3
as
begin
declare @return_var1 int
select @return_var1=sum(LoginId)from Praise
return @return_var1
end
go

declare @varparmer int
exec @varparmer=proc_3
print @varparmer
go

create procedure #proc_4
as
begin
declare @return_var1 int
select @return_var1=sum(LoginId)from Praise
return @return_var1
end
go

declare @varparmer int
exec @varparmer=#proc_4
print @varparmer
go

sql伺服器內部參數使用詳情(預存程序)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.