sql server 删除表及表的相关视图、存储过程、方法

注意:进行此操作前需先备份数据库,免得删错无法恢复

1.查询

SELECT
Name
,type
FROM SysObjects
WHERE name LIKE '%cases%'

2.拼接语句

SELECT
'drop Procedure '+
Name
FROM SysObjects
WHERE name LIKE '%cases%'
AND type='p'; SELECT
'drop view '+
Name
FROM SysObjects
WHERE name LIKE '%cases%'
AND type='v'; SELECT
'drop table '+
Name
FROM SysObjects
WHERE name LIKE '%cases%'
AND type='u'; SELECT
'drop function '+
Name
FROM SysObjects
WHERE name LIKE '%cases%'
AND type='fn'

3.执行删除语句

上一篇:使用entity framework开发oracle


下一篇:[na][QoS]cisco3560限速配置案例-收集于网工泡泡