各位大哥大姐。以下是我的测试存储过程。里面有两个表,我想知道怎么样去分别调用里面的两个表呢?create proc test1
as--table0 相加的
select sum(convert(int,old)) as old,sum(convert(int,price)) as price,sum(convert(int,num)) as num from table1
--table1 相乘的
select convert(int,old)*convert(int,price) as price,convert(int,price)*convert(int,num) as num from table1go比如说我想调用 table0  或者 table1 的怎么调用?或都这样的存储过程存在问题如何改进?谢谢!

解决方案 »

  1.   

    create proc test1
    @flag tinyint
    asif flag=0
    begin
    --table0 相加的
    select sum(convert(int,old)) as old,sum(convert(int,price)) as price,sum(convert(int,num)) as num from table1
    end 
    else
    being
    --table1 相乘的
    select convert(int,old)*convert(int,price) as price,convert(int,price)*convert(int,num) as num from table1
    endgo
      

  2.   

    传参数识别YiZhiNet(YiZhi.Net)的正解