SQL server 查询某个表在哪些存储过程(SP)中使用到

1.查询某个表被哪些存储过程(以下简称 SP)使用到 :

select distinct object_name(id) from syscomments where id in

(select id from sysobjects where type =‘P‘) and text like‘%TableName%‘

2.查找那些过程对该表做了更新操作:

select distinct object_name(id) from syscomments where id in

(select id from sysobjects where type =‘P‘) and text like‘%update tablename%‘

时间: 2024-12-09 16:43:43

SQL server 查询某个表在哪些存储过程(SP)中使用到的相关文章

sql server 查询某个表被哪些存储过程调用

原文:sql server 查询某个表被哪些存储过程调用 sql server 查询某个表被哪些存储过程调用 select distinct object_name(id) from syscomments where id in (select id from sysobjects where type ='P') and text like'%TableName%' 原文地址:https://www.cnblogs.com/lonelyxmas/p/9491635.html

SQL Server 查询锁表和接锁表

SQL Server 查询锁表 select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) as tableName ,* from sys.dm_tran_locks where resource_type='OBJECT' and OBJECT_NAME(resource_associated_entity_id) is not null SQL Server 解锁表 declare @spid int

SQL Server 查询数据库表的列数

1 select count(*) from sysobjects a 2 join syscolumns b 3 on a.id=b.id 4 where a.name='表名' 5 go

SQL SERVER 查询一个表有多少列

select count(1) from syscolumns where id = object_id('tbname') 或者 select * from syscolumns where id = object_id('tbname') 或 SELECT MAX(colid) FROM syscolumns WHERE id=OBJECT_ID('table')

SQL Server 查询所有表使用情况语句

select schema_name(t.schema_id) as [Schema], t.name as TableName,i.rows as [RowCount] from sys.tables as t, sysindexes as i where t.object_id = i.id and i.indid <=1

如何在SQL Server查询语句(Select)中检索存储过程(Store Procedure)的结果集?

如何在SQL Server查询语句(Select)中检索存储过程(Store Procedure)的结果集?(2006-12-14 09:25:36) 与这个问题具有相同性质的其他描述还包括:如何在SQL Server存储过程中获取另一存储过程的执行结果记录集?如何在存储过程中检索动态SQL语句的执行结果?如何实现类似SELECT * FROM (EXEC procedure_name @parameters_var) AS datasource ... 的功能?procedure_

sql server 查询数据库所有的表名+字段

原文:sql server 查询数据库所有的表名+字段 SELECT * FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='Account' SELECT    (case when a.colorder=1 then d.name else '' end) as 表名,--如果表名相同就返回空       a.colorder as 字段序号,       a.name as 字段名,       (case when COLUMNPROPER

SQL 查询某个表被哪些存储过程使用到

--1.查询某个表被哪些存储过程使用到 : select distinct object_name(id) from syscomments where id in (select object_id from sys.objects where type ='P') and text like'%TableName%' --2.查找那些过程对该表做了更新操作: select distinct object_name(id) from syscomments where id in(select

SQL server 数据库用户表名称

转自(http://blog.163.com/jlj_sk/blog/static/22579293200861422833924/) 取得SQL server 数据库中 所有用户表名称 select name from sysobjects where xtype='U' order by name SQL server数据库系统表详解: sysaltfiles 主数据库 保存数据库的文件 syscharsets 主数据库字符集与排序顺序 sysconfigures主数据库 配置选项 sysc