If have created a UDF to enter the weighbridge ticket no and I need this field to be Mandatory while Adding a delivery Note. The below query is executing with error. Kindly advice where have I gone wrong?
if (@object_type in (15) and @transaction_type in ('A' , 'U')
If exists (Select T0.DocEntry from ODLN T0 Inner Join DLN1 on T0.DocEntry = T1.DocEntry Where T0.DocEntry =
@list_of_cols_val_tab_del and T0.U_WBno is null and T0.DocType = 'I')
Select @error = -1, @error_message = 'Weigh bridge Ticket Number is Missing'