while@@FETCH_STATUS=0
Begin
--print@TempId;
set@i=@i+1;
set@UpdateOrder=NUpdate+cast(@TableNameasvarchar(50))+SetintOrder=+cast(@iasvarchar(10))+whereID=+cast(@TempIdasvarchar(10))+;
--print@UpdateOrder;
executesp_executesql@UpdateOrder
fetchnextfromOrder_Cursorinto@TempId
End
CLOSEOrder_Cursor
DEALLOCATEOrder_Cursor
End
if@@error0
Begin
raiserror(排序优化失利,请与开辟商接洽!,16,1)
RollBackTransactionTransOrderOptimize
Return99
end
CommitTransactionTransOrderOptimize
GO
SETQUOTED_IDENTIFIEROFF
GO
SETANSI_NULLSON
GO