W
woodyou
Unregistered / Unconfirmed
GUEST, unregistred user!
CREATE PROCEDURE getnumber @outnumber char(4) out AS declare @count char(4), @mytablename varchar(20) , @myfieldName varchar(20) set @count='0001'while exists(exec ( ' select * from '+@mytablename+' where '+ @myfieldName +'=@count'))beginset @count=@count+1if @count<10set @count='000'+@countELSE IF @count<100SET @count='00'+@countELSE IF @count<1000SET @count='0'+@countENDSET @outnumber =@countGO提示while exists(exec ( ' select * from '+@mytablename+' where '+ @myfieldName +'=@count'))有错误如何解决