set @talCount = (select count(*) from tablea)
if @talCount<@count
begin
     --error!向变量赋值的 SELECT 语句不能与数据检索操作结合使用
      --请问什么原因
end

解决方案 »

  1.   

    error!向变量赋值的 SELECT 语句不能与数据检索操作结合使用
    把这个地方的语句贴上来看看
      

  2.   

    报的是if @talCount<@count
    这行出错了
      

  3.   

    declare @talCount bigint
    set @talCount = (select count(*) from sysobjects)
    print @talCount/*
    102
    */
      

  4.   

    我也试过能print出来,但是执行比较就出错
      

  5.   

    create table tb(a int)
    insert into tb select 1
    insert into tb select 2declare @i int
    select @i=a,a from tb消息 141,级别 15,状态 1,第 6 行
    向变量赋值的 SELECT 语句不能与数据检索操作结合使用。
      

  6.   

    select @talCount=count(*) from tablea
    if @talCount<@count
    begin
         --error!向变量赋值的 SELECT 语句不能与数据检索操作结合使用
          --请问什么原因
    end