declare @now datetime = ; declare @userId int = ; update tbl_WRK_Tasks set taskDescription = , updateDate = @now, updatedBy = @userId, projectId = , dueDate = , priority = , assignedTo = , disposition = , dispositionDate = case when coalesce( disposition, '?' ) != then @now else coalesce( dispositionDate, @now ) end, dispositionUser = case when coalesce( disposition, '?' ) != then @userId else dispositionUser end, -- start of repeating fields repeating = 1, frequency = , repeatUntil = , repeatFrom = , repeating = 0, frequency = null, repeatUntil = null, repeatFrom = null, partnerId = , partnerType = , partnerContactId = , partnerId = null, partnerType = null, partnerContactId = null, dueDateNotification = 10 where ownerId = and ownerType = and taskId = insert into tbl_WRK_Tasks ( ownerId, ownerType, taskType, taskDescription, updateDate, updatedBy, projectId, dueDate, priority, assignedTo, disposition, dispositionDate, dispositionUser, repeating, frequency, repeatUntil, repeatFrom, partnerId, partnerType, partnerContactId, dueDateNotification, createDate, createdBy, requestedBy ) values ( , , 'GEN', , , , , , , , , null, null, -- start of repeating fields 1, , , , 0, null, null, null, , , , null, null, null, 10, , , ) update tbl_CRM_WatchList set active = 'N' where ownerId = and ownerType = and fspro_userId = and subjectId = and subjectType = 'WRT' select taskId from tbl_WRK_Tasks where ownerId = and ownerType = and sourceTaskId = select taskId, taskDescription, disposition, dueDate, updateDate, repeating, frequency, repeatUntil, assignedTo, requestedBy from tbl_WRK_Tasks where ownerId = and ownerType = and taskId = insert into tbl_WRK_Tasks ( ownerId, ownerType, taskType, taskDescription, updateDate, updatedBy, projectId, dueDate, priority, assignedTo, disposition, partnerId, partnerType, partnerContactId, dueDateNotification, createDate, createdBy, requestedBy, sourceTaskId ) select ownerId, ownerType, taskType, taskDescription, updateDate, updatedBy, projectId, dueDate, priority, assignedTo, '?' disposition, partnerId, partnerType, partnerContactId, dueDateNotification, createDate, createdBy, requestedBy, taskId from tbl_WRK_Tasks where ownerId = and ownerType = and taskId =