其实,在存储过程中有许多的操作是不允许的,你可以先create table #tab来实现

解决方案 »

  1.   

    select aa,bb,cc into #bom from tf_bom where prd_no=...
    Declare @sql Varchar(2000)
    Set @sql='Alter table #bom  addd .....'
    Exec(@sql)
    通过了
      

  2.   

    在存儲過程中不能用
    alter table  臨時表的結構
    不過你可改成這種方式
    ------------------
    select aa,bb,cc,dd=0.00000000,ee=0.00000000 into #bom from tf_bom where prd_no=...
      

  3.   

    select aa,bb,cc,cast( 0, numeric(28, 8) as dd,cast( 0, numeric(28, 8) as ee into #bom from tf_bom where prd_no=...
      

  4.   

    select aa,bb,cc,cast( 0 as numeric(28, 8)) as dd,cast( 0 as numeric(28, 8)) as ee into #bom from tf_bom where prd_no=...
      

  5.   

    --加exec,改为后就可以生效了select aa,bb,cc into #bom from tf_bom where prd_no=...
    exec('
    alter #bom add dd numeric(28,8) ,
                   ee numeric(28,8) ')      --这dd,ee的值是取自另外的表