jsfh

1、创建存储过程

create proc 存储过程名称

@参数(可添加多个,格式:@参数,也可不添加参数)

as
begin
select * from Base_Apply where F_Id=@参数(添加参数写法)/  select * from Base_Apply where F_Id=具体值(不添加参数写法)
end;

 

2、判断存储过程是否存在

if exists (select * from dbo.sysobjects where id = object_id(N\'dbo.存储过程名称\') and OBJECTPROPERTY(id, N\'IsProcedure\') = 1) 
print \'存在\'
else
print \'不存在\'

3、判断要创建的存储过程名是否存在    
  if   exists   (select   *   from   dbo.sysobjects   where   id   =   object_id(N’ [dbo].[存储过程名]’)   and   OBJECTPROPERTY(id,   N’IsProcedure’)   =   1)    
  --   删除存储过程    
  drop   procedure   [dbo].[存储过程名]    
  GO  

4 、判断要创建的表名是否存在    
  if   exists   (select   *   from   dbo.sysobjects   where   id   =   object_id(N’ [dbo].[表名]’)   and   OBJECTPROPERTY(id,   N’IsUserTable’)   =   1)    
  --   删除表    
  drop   table   [dbo].[表名]    
  GO   

分类:

技术点:

相关文章:

  • 2021-10-29
  • 2021-11-17
  • 2021-12-19
  • 2021-07-09
  • 2021-06-13
  • 2021-11-17
  • 2021-09-03
  • 2021-12-15
猜你喜欢
  • 2021-11-18
  • 2021-12-22
  • 2021-12-10
  • 2021-10-11
  • 2021-06-01
  • 2021-11-18
  • 2021-11-28
  • 2021-12-25
相关资源
相似解决方案