declare @isWastage bit
declare @partcode varchar(20)set @isWastage=1
set @PartCode='1234567890'if @isWastage=1 --要求计算结果包含损耗
select fpartcode, dosage INTO #TMP2 from tbom007d where fparentpartcode = @PartCode
else
select fpartcode, dosage*2 INTO #TMP2 from tbom007d where fparentpartcode = @PartCode --这一行出错出现以下错误:
服务器: 消息 2714,级别 16,状态 1,行 11
数据库中已存在名为 '#TMP2' 的对象。这是怎么回事啊?谢谢
declare @partcode varchar(20)set @isWastage=1
set @PartCode='1234567890'if @isWastage=1 --要求计算结果包含损耗
select fpartcode, dosage INTO #TMP2 from tbom007d where fparentpartcode = @PartCode
else
select fpartcode, dosage*2 INTO #TMP2 from tbom007d where fparentpartcode = @PartCode --这一行出错出现以下错误:
服务器: 消息 2714,级别 16,状态 1,行 11
数据库中已存在名为 '#TMP2' 的对象。这是怎么回事啊?谢谢
declare @partcode varchar(20)set @isWastage=1
set @PartCode='1234567890'if @isWastage=1 --要求计算结果包含损耗
select fpartcode, dosage INTO #TMP1 from tbom007d where fparentpartcode = @PartCode
else
select fpartcode, dosage*2 INTO #TMP2 from tbom007d where fparentpartcode = @PartCode
declare @partcode varchar(20)set @isWastage=1
set @PartCode='1234567890'if @isWastage=1 --要求计算结果包含损耗
begin
if object_id(N'Tempdb..#TMP2') is not null dorp table #tmp2
select fpartcode, dosage INTO #TMP2 from tbom007d where fparentpartcode = @PartCode
end
else
begin
if object_id(N'Tempdb..#TMP2') is not null dorp table #tmp2 select fpartcode, dosage*2 INTO #TMP2 from tbom007d where fparentpartcode = @PartCode
end --这一行出错
insert into #tmp2 select fpartcode, dosage from tbom007d where fparentpartcode = @PartCode
else
insert into #tmp2 select fpartcode, dosage*2 from tbom007d where fparentpartcode = @PartCode