select @aa=count(*) from dbwyb where bh=@bh
应该是@aa=count(*) 这样吧?
但@aa没有值啊,起码应该是等于零或等于真实的值?

解决方案 »

  1.   

    ???
    不明白,但select @aa=count(*) from dbwyb where bh=@bh这样的确是可以的
      

  2.   

    select @aa=0
    select @aa=count(*) from dbwyb where bh=@bh
      

  3.   

    以上问题解决了,谢谢
    再问一个
    存储过程里的除法,可以这样写吗?
    @aa/@ab?  好象没有结果啊,?
      

  4.   

    明明@aa=2, @ab=3  而@aa/@ab  等于0
    为什么?
      

  5.   

    把count(*) 
    改成
    count(其中一个字段名)
    试试
      

  6.   

    你的@aa 和@ab 是不是声明为int型?
    改成float型就可以了,如:
    declare @a float
    declare @b float
    set @a=2
    set @b=3print @a
    print @b
    print @a / @b
      

  7.   

    @@VAR是全局变量
    定义一般的只能用@VAR