在SQL2000中怎样实现存储过程的删除,添加,修改。请各位高手帮一下忙,很急,谢谢

解决方案 »

  1.   

    --删除
    drop proc  存储过程名
    --修改
    alter proc 存储过程名
    as

    --添加
    create proc 存储过程名
      

  2.   


    Use 数据库
    GOif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].存储过程名') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    前面加这个判断会好一些
      

  3.   

    SET QUOTED_IDENTIFIER ON 
    GO
    SET ANSI_NULLS ON 
    GOALTER    proc lt_inoutquery
    (
    @querytype int,
    @selecttext nvarchar(4000)
    )
    as
    declare @selectsql nvarchar(4000)--最终查询语句
    if(@querytype=1)--历史记录查询
    begin
    set @selectsql=@selecttext
    exec (@selectsql)
    end
    else if(@querytype=2)--同批次查询
    begin
    set @selectsql=@selecttext
    exec (@selectsql)
    end
    else if(@querytype=3)
    begin
    set @selectsql=@selecttext
    exec (@selectsql)
    endGO
    SET QUOTED_IDENTIFIER OFF 
    GO
    SET ANSI_NULLS ON 
    GO