Hello guys,
I would like to prevent users from changing the additional identifier field (OCRD.AddID) once it is added. So they can add a new value but can't update or delete it.
I'm unsure how to get the value entered and check it against the existing one. I tried the code below but it didn't behave as I expected. Did anyone have a similar requirement before and how did you do it?
Thanks.
IF
@object_type = '2' AND @transaction_type IN ('U', 'D')
BEGIN
IF
(SELECT AddID FROM ACRD WHERE CardCode=@list_of_cols_val_tab_del AND loginstanc =
(SELECT MAX(ACRD.LogInstanc) FROM ACRD WHERE CardCode=@list_of_cols_val_tab_del)) IS NULL
AND
(SELECT AddID FROM OCRD WHERE CardCode=@list_of_cols_val_tab_del) NOT LIKE
(SELECT AddID FROM ACRD WHERE CardCode=@list_of_cols_val_tab_del AND loginstanc =
(SELECT MAX(ACRD.LogInstanc) FROM ACRD WHERE CardCode=@list_of_cols_val_tab_del))
BEGIN
SET @error =1
SET @error_message = 'You cannot change or delete the BPAY ref no.'
END
END