SQL常用语句
来源:互联网 发布:c 网络爬虫 编辑:程序博客网 时间:2024/05/20 14:43
--sql查询某个表被那些存储过程用到
select distinct object_name(id) from syscomments
where id in (select object_id from sys.objects where type ='P')
and UPPER(text) like '%READ_IVTEST%' order by object_name(id)
/*type char(2) 对象类型。可以是下列值之一:
C = CHECK 约束
D = 默认值或 DEFAULT 约束
F = FOREIGN KEY 约束
FN = 标量函数
IF = 内嵌表函数
K = PRIMARY KEY 或 UNIQUE 约束
L = 日志
P = 存储过程
R = 规则
RF = 复制筛选存储过程
S = 系统表
TF = 表函数
TR = 触发器
U = 用户表
V = 视图
X = 扩展存储过程*/
select distinct object_name(id) from syscomments
where id in (select object_id from sys.objects where type ='P')
and UPPER(text) like '%READ_IVTEST%' order by object_name(id)
/*type char(2) 对象类型。可以是下列值之一:
C = CHECK 约束
D = 默认值或 DEFAULT 约束
F = FOREIGN KEY 约束
FN = 标量函数
IF = 内嵌表函数
K = PRIMARY KEY 或 UNIQUE 约束
L = 日志
P = 存储过程
R = 规则
RF = 复制筛选存储过程
S = 系统表
TF = 表函数
TR = 触发器
U = 用户表
V = 视图
X = 扩展存储过程*/
---查看锁表--spid 锁表进程--tableName 被锁表名
select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type='OBJECT'
select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type='OBJECT'
---解锁语句
declare @spid int
Set @spid = 136
--锁表进程
declare @sql varchar(1000)set
@sql='kill '+cast(@spid as varchar)exec(@sql)
declare @spid int
Set @spid = 136
--锁表进程
declare @sql varchar(1000)set
@sql='kill '+cast(@spid as varchar)exec(@sql)
--查询所有的存储过程
select a.name,a.[type],b.[definition] from sys.all_objects a,sys.sql_modules b
where a.is_ms_shipped=0 and a.object_id = b.object_id and a.[type] in ('P')
order by a.[name] asc
阅读全文
0 0
- SQL语句 常用语句
- sql常用sql语句
- SQLite 常用语句 sql语句
- oracle常用SQL语句
- DBA常用SQL语句
- DBA常用SQl语句
- 常用SQL语句
- 常用SQL语句
- oracle常用SQL语句
- oracle常用SQL语句
- 管理常用SQL语句
- 管理常用SQL语句
- 管理常用SQL语句
- 常用SQL语句(Update)
- 常用SQL语句
- SQL常用语句大全
- 常用sql语句1
- 常用Sql语句
- 百练2593:Max Sequence
- java学习笔记之: spring-aop
- 使用JSON
- spark<log4j配置控制台日志级别输出>
- 如何在一个textview中使用不同颜色的字体
- SQL常用语句
- 前端面试题及答案总结
- direct path read /write(直接路径读/写)
- Mybatis配置文件中的mapUnderscoreToCamelCase属性
- Sublime text3 v3.0 build3143注册码
- Android--关于Fragment的基础介绍(二)
- 函数的参数
- win10 64位系统 微星GE62 安装Linux ubutuntu 系统Deepin的过程
- [leetcode] 第二周作业