Audit Status Change Bulk
SELECT * FROM dbo.AuditStatusMaster asm
SELECT * FROM dbo.AuditSectionStatusMaster assm
SELECT * FROM dbo.SeverityMaster sm
--2 Auditing In Progress
--6 Auditing Completed
--7 Coaching Completed Feedback Pending
--11 Acknowledged
--12 Coaching In Progress
--1 Section Auditing In Progress
--2 Section Auditing Completed
--3 Section Coaching Completed
--4 Section Feedback Sent Ack Pending
--5 Section Accepted
--6 Section Declined
--1 Low
--2 Medium
--3 High
--Audit Section Status Change
SELECT * FROM dbo.AuditSectionDetail asd
INNER JOIN dbo.Audit a ON asd.AuditId = a.Id AND a.SeverityId = 1
WHERE asd.AuditSectionStatusId NOT IN (1,5,6)
UPDATE asd SET asd.AuditSectionStatusId = 5 FROM dbo.AuditSectionDetail asd
INNER JOIN dbo.Audit a ON asd.AuditId = a.Id AND a.SeverityId = 1
WHERE asd.AuditSectionStatusId NOT IN (1,5,6)
--Audit Status Change
SELECT * FROM dbo.Audit a WHERE a.IsActive = 1 AND a.SeverityId = 1 AND a.AuditStatusId not IN (2,11)
UPDATE a SET a.AuditStatusId = 11 FROM dbo.Audit a WHERE a.IsActive = 1 AND a.SeverityId = 1 AND a.AuditStatusId not IN (2,11)