SQL儲存過程相關資訊檢視轉

2021-09-08 03:46:52 字數 902 閱讀 7651

--1、檢視所有儲存過程與函式

exec sp_stored_procedures

或者 select * from dbo.sysobjects where objectproperty(id, n'isprocedure') = 1 order by name

--2、檢視儲存過程的內容   

select text from syscomments where id=object_id('儲存過程名稱')

-- 或者用

sp_helptext  儲存過程名稱

--3、檢視儲存過程的引數情況

select '引數名稱' = name,

'型別' = type_name(xusertype),

'長度' = length,   

'引數順序' = colid,

'排序方式' = collation

from    syscolumns

where   id=object_id('儲存過程名稱')

--4、檢視所有儲存過程內容

select   b.name   ,a.text   from   syscomments   a,sysobjects   b   where   object_id(b.name)=a.id   and   b.xtype   in('p','tr')

--5、檢視包含字串內容的儲存過程

select   b.name   ,a.text   from   syscomments   a,sysobjects   b

where

charindex('字串內容',a.text)>0    and

object_id(b.name)=a.id   and   b.xtype   in('p','tr')

SQL儲存過程相關資訊檢視

1 檢視所有儲存過程與函式 exec sp stored procedures 或者select from dbo.sysobjects where objectproperty id,n isprocedure 1 order by name 2 檢視儲存過程的內容 select text fro...

SQL儲存過程相關資訊檢視

1 檢視所有儲存過程與函式 exec sp stored procedures 或者 select from dbo.sysobjects where objectproperty id,n isprocedure 1 order by name 2 檢視儲存過程的內容 select text fr...

SqlServer中Sql檢視儲存過程

一 利用sql語句查詢資料庫中的所有表 1.利用sysobjects系統表 select from sysobjects where xtype u 2,利用sys.tables目錄檢視 sys.tables目錄檢視,為每個表物件返回一行.select from sys.tables 注意 sys....