/*
select * from [dbo].[Objects_tbl]
where [Id] = 'd0d9a3b0-27bb-40c6-a558-b17920568ab7'
*/

goto Next1
UPDATE Objects_tbl SET ProcStateCol01 = 'D.Hallo'
                       -- ObjectLastModDate = GetDate(),
                       , ObjectLastSavDate = GetDate()
					   , ObjectName = ObjectName + '-#Debug'
					   where [Id] = 'd0d9a3b0-27bb-40c6-a558-b17920568ab7'
Next1:


UPDATE Objects_tbl SET ProcStateCol01 = 'N', ProcStateCol02 = 'N' , ProcStateCol03 = 'N'
                       , ObjectLastModDate = GetDate()
                       , ObjectLastSavDate = GetDate()
					   -- , ObjectName = ObjectName + '-#Debug'
					   where [Id] = '167451e8-b8d1-49b1-8681-52da595a6d9d'



-- goto MyExit

delete from Objects_tbl where ID IN ('2c89ff6a-3b09-4b72-9be0-7aebf01af42e','2c89ff6a-3b09-4b72-9be0-7aebf01af43e','2c89ff6a-3b09-4b72-9be0-7aebf01af44e','2c89ff6a-3b09-4b72-9be0-7aebf01af45e')

delete from JobControl_ObjectsProcessData_tbl where Objects_tbl_ID IN ('167451e8-b8d1-49b1-8681-52da595a6d9d','2c89ff6a-3b09-4b72-9be0-7aebf01af42e','2c89ff6a-3b09-4b72-9be0-7aebf01af43e','2c89ff6a-3b09-4b72-9be0-7aebf01af44e','2c89ff6a-3b09-4b72-9be0-7aebf01af45e')

-- goto MyExit

insert into Objects_tbl (ID ,                                   ProcStateCol01, ProcStateCol02, ProcStateCol03, ObjectClass , ObjectPuid ,        ObjectCliName, ObjectName,   ObjectName2,    ObjectFromSiteID , ObjectLastModDate)
                VALUES ('2c89ff6a-3b09-4b72-9be0-7aebf01af42e', 'D.OK',         'D.WRN',       'D.ERR' ,  'I',  'i4NAAE06bEXlwX',   '@DB/4711-001', '4711-001',  'ObjectName-2', 'TC11ADDPLM',       GetDate())

-- goto MyExit
INSERT INTO
  dbo.JobControl_ObjectsProcessData_tbl
(
  Row_isLastRes, ProcessProcStateCol, ProcessState,  Id,  Objects_tbl_ID,  ProcessPacketName,  ProcessTimeStart,  ProcessTimeEnd, ProcessCMDLine, ProcessResultCode,  ProcessResultMsg,  ProcessResultExtendedData,  ProcessResultHasWarning,  ProcessResultLink,  ProcessOnComputer,  ProcessPrgUsedVer,  ProcessObjectSaveVersion,  TaskScheduler_tbl_ID,  ProcessCategory
)
VALUES (
  0, 'ProcStateCol01', 'D.P1.OK', NEWID(), '2c89ff6a-3b09-4b72-9be0-7aebf01af42e', 'ProcessPacketName', GetDate(), GetDate()+1, 'ProcessCMDLine', '0', 'ProcessResultMsg', 'ProcessResultExtendedData', 0, 'ProcessResultLink', 'ProcessOnComputer', 'ProcessPrgUsedVer',   'ProcessObjectSaveVersion',   Null, 'ProcessCategory'
)

WAITFOR DELAY '00:00:00.5'

INSERT INTO
  dbo.JobControl_ObjectsProcessData_tbl
(
  Row_isLastRes, ProcessProcStateCol, ProcessState,  Id,  Objects_tbl_ID,  ProcessPacketName,  ProcessTimeStart,  ProcessTimeEnd, ProcessCMDLine, ProcessResultCode,  ProcessResultMsg,  ProcessResultExtendedData,  ProcessResultHasWarning,  ProcessResultLink,  ProcessOnComputer,  ProcessPrgUsedVer,  ProcessObjectSaveVersion,  TaskScheduler_tbl_ID,  ProcessCategory
)
VALUES (
  1, 'ProcStateCol01', 'D.P1.2.OK', NEWID(), '2c89ff6a-3b09-4b72-9be0-7aebf01af42e', 'ProcessPacketName', GetDate(), GetDate()+1, 'ProcessCMDLine', '0', 'ProcessResultMsg', 'ProcessResultExtendedData', 0, 'ProcessResultLink', 'ProcessOnComputer', 'ProcessPrgUsedVer',   'ProcessObjectSaveVersion',   Null, 'ProcessCategory'
)
-- goto Next3

WAITFOR DELAY '00:00:00.5'
INSERT INTO
  dbo.JobControl_ObjectsProcessData_tbl
(
  Row_isLastRes, ProcessProcStateCol, ProcessState,  Id,  Objects_tbl_ID,  ProcessPacketName,  ProcessTimeStart,  ProcessTimeEnd, ProcessCMDLine, ProcessResultCode,  ProcessResultMsg,  ProcessResultExtendedData,  ProcessResultHasWarning,  ProcessResultLink,  ProcessOnComputer,  ProcessPrgUsedVer,  ProcessObjectSaveVersion,  TaskScheduler_tbl_ID,  ProcessCategory
)
VALUES (
  1, 'ProcStateCol02', 'D.P2.WRN', NEWID(), '2c89ff6a-3b09-4b72-9be0-7aebf01af42e', 'ProcessPacketName', GetDate(), GetDate()+1, 'ProcessCMDLine', '0', 'ProcessResultMsg', 'ProcessResultExtendedData', 0, 'ProcessResultLink', 'ProcessOnComputer', 'ProcessPrgUsedVer',   'ProcessObjectSaveVersion',   Null, 'ProcessCategory'
)

WAITFOR DELAY '00:00:00.5'

INSERT INTO
  dbo.JobControl_ObjectsProcessData_tbl
(
  Row_isLastRes, ProcessProcStateCol, ProcessState,  Id,  Objects_tbl_ID,  ProcessPacketName,  ProcessTimeStart,  ProcessTimeEnd, ProcessCMDLine, ProcessResultCode,  ProcessResultMsg,  ProcessResultExtendedData,  ProcessResultHasWarning,  ProcessResultLink,  ProcessOnComputer,  ProcessPrgUsedVer,  ProcessObjectSaveVersion,  TaskScheduler_tbl_ID,  ProcessCategory
)
VALUES (
  1, 'ProcStateCol03', 'D.P3.ERR', NEWID(), '2c89ff6a-3b09-4b72-9be0-7aebf01af42e', 'ProcessPacketName', GetDate(), GetDate()+1, 'ProcessCMDLine', '0', 'ProcessResultMsg', 'ProcessResultExtendedData', 0, 'ProcessResultLink', 'ProcessOnComputer', 'ProcessPrgUsedVer',   'ProcessObjectSaveVersion',   Null, 'ProcessCategory'
)

Next3:
WAITFOR DELAY '00:00:00.5'

INSERT INTO
  dbo.JobControl_ObjectsProcessData_tbl
(
  Row_isLastRes, ProcessProcStateCol, ProcessState,  Id,  Objects_tbl_ID,  ProcessPacketName,  ProcessTimeStart,  ProcessTimeEnd, ProcessCMDLine, ProcessResultCode,  ProcessResultMsg,  ProcessResultExtendedData,  ProcessResultHasWarning,  ProcessResultLink,  ProcessOnComputer,  ProcessPrgUsedVer,  ProcessObjectSaveVersion,  TaskScheduler_tbl_ID,  ProcessCategory
)
VALUES (
  1, 'ProcStateCol01', 'D.P1.WELL.OK', NEWID(), '167451e8-b8d1-49b1-8681-52da595a6d9d', 'ProcessPacketName', GetDate(), GetDate()+1, 'ProcessCMDLine', '0', 'ProcessResultMsg', 'ProcessResultExtendedData', 0, 'ProcessResultLink', 'ProcessOnComputer', 'ProcessPrgUsedVer',   'ProcessObjectSaveVersion',   Null, 'ProcessCategory'
)



select ProcessProcStateCol, * from  dbo.JobControl_ObjectsProcessData_tbl
where Objects_tbl_ID IN ('2c89ff6a-3b09-4b72-9be0-7aebf01af42e','167451e8-b8d1-49b1-8681-52da595a6d9d')


/*
insert into Objects_tbl (ID ,  ObjectClass ,                          ObjectPuid ,          ObjectName,         ObjectName2,   ObjectFromSiteID  , ObjectLastModDate)
                VALUES ('2c89ff6a-3b09-4b72-9be0-7aebf01af42e', 'I', 'ObjectPuid-#Debug1', 'ObjectName-#Debug', 'ObjectName-1', 'TC11ADDPLM-10-VMtc91' , GetDate())

insert into Objects_tbl (ID ,  ObjectClass ,                          ObjectPuid ,          ObjectName,         ObjectName2,   ObjectFromSiteID  , ObjectLastModDate)
                VALUES ('2c89ff6a-3b09-4b72-9be0-7aebf01af43e', 'I', 'ObjectPuid-#Debug2', 'ObjectName-#Debug', 'ObjectName-2', 'TC11ADDPLM-10-VMtc91' , GetDate())

goto MyExit
insert into Objects_tbl (ID ,  ObjectClass ,                          ObjectPuid ,          ObjectName,         ObjectName2,   ObjectFromSiteID  , ObjectLastModDate)
                VALUES ('2c89ff6a-3b09-4b72-9be0-7aebf01af44e', 'I', 'ObjectPuid{-#Debug1', 'ObjectName{-#Debug', 'ObjectName-1', 'TC11ADDPLM-10-VMtc91' , GetDate())

insert into Objects_tbl (ID ,  ObjectClass ,                          ObjectPuid ,          ObjectName,         ObjectName2,   ObjectFromSiteID  , ObjectLastModDate)
                VALUES ('2c89ff6a-3b09-4b72-9be0-7aebf01af45e', 'I', 'ObjectPuid{-#Debug2', 'ObjectName{-#Debug', 'ObjectName-2', 'TC11ADDPLM-10-VMtc91' , GetDate())


insert into Objects_tbl (ID ,  ObjectClass ,                          ObjectPuid ,          ObjectName,         ObjectName2,   ObjectFromSiteID  , ObjectLastModDate)
                VALUES ('2c89ff6a-3b09-4b72-9be0-7aebf01af45e', 'I', 'ObjectPuid{-#Debug2', 'ObjectName{-#Debug', 'ObjectName-2', 'TC11ADDPLM-10-VMtc91' , GetDate())

INSERT INTO
  dbo.JobControl_ObjectsProcessData_tbl
(
  Id
  Objects_tbl_ID,
  ProcessPacketName,
  ProcessState,
  ProcessTimeStart,
  ProcessTimeEnd,
  ProcessCMDLine,
  ProcessResultCode,
  ProcessResultMsg,
  ProcessResultExtendedData,
  ProcessResultHasWarning,
  ProcessResultLink,
  ProcessOnComputer,
  ProcessProcStateCol,
  ProcessPrgUsedVer,
  ProcessObjectSaveVersion,
  Row_isLastRes,
  TaskScheduler_tbl_ID,
  ProcessCategory,
  ProcessTimeDuration
)
VALUES (
   NEWID(),
  '2c89ff6a-3b09-4b72-9be0-7aebf01af45e',
  'ProcessPacketName',
  'ProcessState,
  'ProcessTimeStart,
  GetDate(),
  'ProcessCMDLine,
  'XX',
  'ProcessResultMsg,
  'ProcessResultExtendedData,
  'ProcessResultHasWarning,
  'ProcessResultLink,
  'ProcessOnComputer,
  'ProcessProcStateCol,
  'ProcessPrgUsedVer,
  'ProcessObjectSaveVersion,
  'Row_isLastRes,
  :TaskScheduler_tbl_ID,
  :ProcessCategory,
  :ProcessTimeDuration
);
*/

MyExit:

           