我现在要写这样一个存储过程,在这个存储过程里要加条件,比如一个存储过程的功能是插入
在插入之前我要先判断是一个值,这个值是从界面上得到的,这个值如果是1,就执行1对应的存储过程,如果是2就执行2对应的存储过程.但都是插入功能,其实就是把存储过程和到一起了!这个怎么做?请高手赐教~

解决方案 »

  1.   

    CREATE  PROCEDURE name
    @strCMD int
    ASIF @strCMD = 1IF @strCMD = 2
      

  2.   

    CREATE PROCEDURE name
    @strCMD int
    ASIF @strCMD = 1
    begin
    endIF @strCMD = 2
    begin
    end
      

  3.   

    create proc pp 
    @a int
    as
    if @a=1
    begin
    ........
    end
    if @a=2
    begin
    ........
    end
      

  4.   


    情况是这样的,我有一个语言表,在界面上将语言表里的数据读出来,然后根据选择的语言来进行执行存储过程.这个怎么做?
    比如有语言表A(id,languge)
    表B(id,langugeID...)
    这个该怎么操作呢??请赐教!
      

  5.   


    create proc P_insert
      @id intas   if @id=1 
        begin 
          insert ...
        end
      else 
         if  @id=2
          begin
           insert ...
          end
    GOexec P_insert 1
      

  6.   

    create proc proc_name
    @id int
    as 
    if @id=1
    begin
    end
    if @id=2
    begin
    end
      

  7.   

    case 判断字段
    when '条件1' then exec proc1
    when '条件2' then exec proc2
    when '条件3' then exec proc3
    when '条件4' then exec proc4
    else proc5
    end