Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

?-- =============================================
-- Description: Sets the HasProvisionalDiagnosis bit field to true/false
--
-- Maintenance Log:
--
-- Update By Update Date Description
-- ----------- --------- ----------------------------
-- =============================================
CREATE PROCEDURE zraw.[uspDoSetOneConsultsHasProvisionalDiagnosis]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @batchTable TABLE
(
BatchLogID bigint Primary Key,
TableName varchar (50),
BatchDate datetime2(7)
)

BEGIN TRY
--need to restrict the records we modified to only those available for internalprocessing
INSERT INTO @batchTable (BatchLogID, TableName, BatchDate)
SELECT * FROM dbo.ufnGetBatchLogBatchDate ('INTPROCESSING', null)

--set the HasProvisionalDiagnosisCode = true
--rules for the field are NOT NULL in the ProvisionalDiagnosisText field
--ProvisionalDiagnosisText
UPDATE dbo.OneConsults WITH (TABLOCK)
SET HasProvisionalDiagnosis = 1
FROM dbo.OneConsults OC
INNER JOIN @batchTable bt ON OC.BATCHLOGID = bt.BatchLogID
WHERE ProvisionalDiagnosisText IS NOT NULL; --marking both fields separately


--set the HasProvisionalDiagnosisCode = true
--rules for the field are NOT NULL in the ProvisionalDiagnosisCode field
--ProvisionalDiagnosisCode
UPDATE dbo.OneConsults WITH (TABLOCK)
SET HasProvisionalDiagnosis = 1
FROM dbo.OneConsults OC
INNER JOIN @batchTable bt ON OC.BATCHLOGID = bt.BatchLogID
WHERE ProvisionalDiagnosisCode IS NOT NULL; --marking both fields separately



END TRY
BEGIN CATCH
PRINT 'There was an error setting the HasProvisionalDiagnosis bit field' + CHAR(13);
THROW;
END CATCH
END