use QPTreasureDB declare @beginID bigint declare @endID bigint declare @serID bigint --机器人起始号 set @beginID = 210 --机器人结束号 set @endID = 220 --房间号 set @serID = 45 begin Transaction begin Try ---------------------------------- while(@beginID<= @endID) begin INSERT INTO [QPTreasureDB].[dbo].[AndroidManager] ([UserID] ,[ServerID] ,[MinPlayDraw] ,[MaxPlayDraw] ,[MinTakeScore] ,[MaxTakeScore] ,[MinReposeTime] ,[MaxReposeTime] ,[ServiceTime] ,[ServiceGender] ,[Nullity] ,[CreateDate] ,[AndroidNote]) select @beginID ,@serID ,'100' ,'10000' ,'1000' ,'10000' ,'1000' ,'100000' ,'16777215' ,'6' ,'0' ,GETDATE() ,'生成机器人' set @beginID=@beginID + 1 end --------------------------------- commit Tran end Try begin Catch rollback Tran declare @sTemp varchar(1000) select @sTemp=ERROR_MESSAGE() raiserror(@sTemp,16,1) end Catch |