我写了一段存储过程是在 SQL SERVER 2005环境下写的:
ALTERPROC [dbo].[SHOW_BOM](@father varchar(20),@TQty numeric(19,6))
as
begin
declare @level int
declare @code varchar(20)
declare @childnum int
declare @quantity numeric(19,6)
-- select @@nestlevel
set @level=@@nestlevel --嵌套层次
if @@nestlevel=-1 --顶层
begin
set @TQty=1
insert z_showbom(code,father,childnum,quantity,level1,level2) select @father,@code,0,1,0,'0'
end
else if @@nestlevel0) Drop table BOMLIST
select IDENTITY(int,1,1) AS ID_Num, t1.* into temp124 from z_showbom t1
select * from temp124
问题:在运行代码2若干次以后,结果的次序是头一次的结果是不一样的,请问大家这是什么问题。
谢谢!
|