 
 /*
 USE [We_AppDb_V2.3]; 
 DECLARE @NO NVARCHAR(50);	SET @NO='JY2001000010079_';
 
 UPDATE [dbo].[Train_Camps] SET [CampState]=2,[StartDate]=NULL WHERE [Id]=@NO
 UPDATE [dbo].[Train_CampGroups] SET [CampGroupState]=1,[RunningInfo]=NULL,[StartDate]=NULL,[EngDate]=NULL,[RoundIndex]=1 WHERE [CampNo]=@NO
 UPDATE [dbo].[Train_CampGroupScores] SET [SystemScore]=0,[CorrectionScore]=0,[SpecialistScore]=0,[AudienceScore]=0,[ReferenceScore]=0,[FinalTotalScore]=0,[BehaviorTagScoreInfo]='' WHERE [CampNo]=@NO
 UPDATE  [dbo].[Train_CampGroupLogs] SET LogState=1  WHERE LogType=2 AND (LogState=2 OR LogState=3 OR LogState=4  OR LogState=5) AND [CampNo]=@NO 
 DELETE  [dbo].[Train_CampGroupScores] WHERE [CampNo]=@NO 
 DELETE  [dbo].[Train_CampGroupLogs] WHERE [CampNo]=@NO 
 DELETE  [dbo].[Train_CampGroupPortraits] WHERE [CampNo]=@NO
 DELETE  [dbo].[Train_CampGroupRoles] WHERE [GroupNo] like @NO+'%'
 
 


 USE [We_AppDb_V2.3]; s
 DECLARE @NO NVARCHAR(50);	SET @NO='JY2001000010075';

 DELETE  [dbo].[Train_CampGroupScores] WHERE [CampNo]=@NO 
 DELETE  [dbo].[Train_CampGroupLogs] WHERE [CampNo]=@NO 
 DELETE  [dbo].[Train_CampGroupPortraits] WHERE [CampNo]=@NO
 DELETE  [dbo].[Train_CampGroupRoles] WHERE [GroupNo] like @NO+'%'
 --DELETE  [dbo].[Train_CampHelps] WHERE [CampNo]=@NO 
  --DELETE  [dbo].[Train_CampGroups] WHERE [CampNo]=@NO 
  --DELETE  [dbo].[Train_Camps] WHERE [Id]=@NO 

 */

  /*
 
  -- 配置培训营 更改@NO为需配置的培训营编码
  USE[We_AppDb_V2.3]; 
  DECLARE @NO1 NVARCHAR(50);	SET @NO1='JY2001000010090_';
 
  DECLARE scMap CURSOR FOR SELECT SceneNo,SceneName,AttachNos FROM Train_CampSceneMaps WHERE CampNo= 'JY2001000010075'
  BEGIN TRY
	DECLARE @SceneNo NVARCHAR(MAX), @SceneName NVARCHAR(MAX), @AttachNos NVARCHAR(MAX)
	OPEN scMap
	FETCH  scMap INTO @SceneNo, @SceneName,@AttachNos
    WHILE @@fetch_status=0    
    BEGIN 
		PRINT   @SceneNo
		INSERT INTO [dbo].[Train_CampSceneMaps] ([SceneNo],[SceneName],[AttachNos],[CampNo] ,[CreationTime] ,[CreatorUserId],[PhoneQuestionNo])
			VALUES  ( @SceneNo, @SceneName, @AttachNos, @NO1, GETDATE(),3  ,NULL)
	   FETCH  scMap INTO @SceneNo, @SceneName,@AttachNos
	END
	CLOSE scMap
	DEALLOCATE  scMap
  END TRY
  BEGIN CATCH 
	CLOSE scMap
	DEALLOCATE  scMap
	PRINT 'ERROR'
  END CATCH
  
  BEGIN TRY
     UPDATE [dbo].[Train_Camps]  SET [CampState]=2,[StartDate]=NULL,[AssessAuto]=B.AssessAuto,RoundScore=B.RoundScore,TrainingMinute=B.TrainingMinute ,
	 AssessRoleNames=B.AssessRoleNames,[Address]=B.[Address],MaxRoundMinute=B.MaxRoundMinute,[Description]=B.[Description],[EvalBehaviorTags]=B.[EvalBehaviorTags],[Remark]=B.[Remark]
	 FROM  (SELECT [AssessAuto],[AssessRoleNames],[Address],[MaxRoundMinute],[RoundScore],[TrainingMinute],[Description],[EvalBehaviorTags],[Remark] FROM  [dbo].[Train_Camps] where [Id]= 'JY2001000010075') as B  WHERE [Id]=@NO1
  END TRY
  BEGIN CATCH 
  END CATCH

  BEGIN TRY
    INSERT INTO [dbo].[Train_CampGroups]
           ([Id] ,[Name],[CampNo],[CampGroupState] ,[StartDate],[EngDate] ,[TrainingMinute],[IsDeleted],[DeleterUserId],[DeletionTime],[LastModificationTime],[LastModifierUserId],
		   [CreationTime],[CreatorUserId] ,[RunningInfo] ,[RoundIndex])
     VALUES
           (@NO1+'_001','第1组',@NO1,1,NULL,NULL,0 ,0 ,NULL ,NULL ,NULL,NULL ,GETDATE(),3 ,NULL ,0)
	INSERT INTO [dbo].[Train_CampGroups]
           ([Id] ,[Name],[CampNo],[CampGroupState] ,[StartDate],[EngDate] ,[TrainingMinute],[IsDeleted],[DeleterUserId],[DeletionTime],[LastModificationTime],[LastModifierUserId],
		   [CreationTime],[CreatorUserId] ,[RunningInfo] ,[RoundIndex])
     VALUES
           (@NO1+'_002','第2组',@NO1,1,NULL,NULL,0 ,0 ,NULL ,NULL ,NULL,NULL ,GETDATE(),3 ,NULL ,0)
	INSERT INTO [dbo].[Train_CampGroups]
           ([Id] ,[Name],[CampNo],[CampGroupState] ,[StartDate],[EngDate] ,[TrainingMinute],[IsDeleted],[DeleterUserId],[DeletionTime],[LastModificationTime],[LastModifierUserId],
		   [CreationTime],[CreatorUserId] ,[RunningInfo] ,[RoundIndex])
     VALUES
           (@NO1+'_003','第3组',@NO1,1,NULL,NULL,0 ,0 ,NULL ,NULL ,NULL,NULL ,GETDATE(),3 ,NULL ,0)
  END TRY
  BEGIN CATCH 
  END CATCH
  BEGIN TRY
	INSERT INTO [dbo].[Train_CampRoleGroups] ([RoleGroupNo],[CampNo],[CreationTime],[CreatorUserId]) VALUES ('JY2012000000251' ,@NO1 ,GETDATE()  ,3)
    INSERT INTO [dbo].[Train_CampRoleGroups] ([RoleGroupNo],[CampNo],[CreationTime],[CreatorUserId]) VALUES ('JY2012000000252' ,@NO1 ,GETDATE()  ,3)
    INSERT INTO [dbo].[Train_CampRoleGroups] ([RoleGroupNo],[CampNo],[CreationTime],[CreatorUserId]) VALUES ('JY2012000000253' ,@NO1 ,GETDATE()  ,3)
    INSERT INTO [dbo].[Train_CampRoleGroups] ([RoleGroupNo],[CampNo],[CreationTime],[CreatorUserId]) VALUES ('JY2012000000254' ,@NO1 ,GETDATE()  ,3)
    INSERT INTO [dbo].[Train_CampRoleGroups] ([RoleGroupNo],[CampNo],[CreationTime],[CreatorUserId]) VALUES ('JY2012000000255' ,@NO1 ,GETDATE()  ,3)
  END TRY
  BEGIN CATCH 
  END CATCH
 
  
   */
  

  
 