从前我无论删表还是删除存储过程都是否样删除的
if exists(select * from sysobjects where name = 'Name')
drop table/proc/trigger Name
go请问如果我想要分门别类去在括号中查询,然后再删除应该怎么去做就是我想删除存储过程,那么查询出来的都是存储过程,然后再name中判断是否是想要删除的
.....
说得不太清楚,请见谅..
谢谢帮助我的朋友
if exists(select * from sysobjects where name = 'Name')
drop table/proc/trigger Name
go请问如果我想要分门别类去在括号中查询,然后再删除应该怎么去做就是我想删除存储过程,那么查询出来的都是存储过程,然后再name中判断是否是想要删除的
.....
说得不太清楚,请见谅..
谢谢帮助我的朋友
解决方案 »
- 数据库的第三范示具体是在第二范示加了什么条件,能举个通俗易懂的例子就好了。
- SQL 时间控制事务
- 四表关联按分类汇总的SQL语句,急,解决结帖
- 如何创建及分配文件组?
- 远程连接不通
- 为什么在两个SQL server数据库之间用DTS导出\导入一个表时,字段描述丢失?
- ERWIN连接上了数据库SQL SERVER如何建立表关系?~_~
- SQL查询输出到文本失败 EXEC master..xp_cmdshell 'bcp "select filename from VAD..AdFile"
- 表的大小和查询的速度
- Sql server 的分布式事务处理
- 规则和check约束都可以实现同样的功能,那么有什么区别呢?
- 关于表、视图、存储过程的调用
TR = 触发器
U = 用户表
xtype='p'存储
'v'视图
if exists(select * from sysobjects where name = 'Name' and xtype='P')
drop proc Name
go
begin
declare @id int
set @id=object_id('Name')
if objectproperty(@id,'istable')=1
drop table Name
else if objectproperty(@id,'isveiw')=1
drop view Name
else if objectproperty(@id,'isprocedure')=1
drop proc Name
else if objectproperty(@id,'istrigger')=1
drop trigger Nameend
就是证明有这个name表存在么?
drop table/proc/trigger Name
go
即可分类删除了.
go
if exists(select * from sysobjects where xtype='p' and name = 'Name')
drop proc Name
go
if exists(select * from sysobjects where xtype='tr' and name = 'Name')
drop trigger Name
go
if exists(select * from sysobjects where xtype='u' and name = 'Name')
drop table Name