on 10-20-2015 7:18 AM
Hi experts,
Just want to ask a big favor, iam new to stored procedure, please check my script if its correct: all i want is all if ocrcode code is null or ocrcode5 is null and also invtype = 13 then message 'Please Choose Branch and Department' will show.
please check my script below - thank you very much in advance...
if (@object_type = '24 ') and (@transaction_type= 'A' or @transaction_type= 'U')
BEGIN
If Exists (Select T0.DocNum from ORCT T0 Inner Join RCT2 T1 On T0.DocNum=T1.DocNum
Where T1.OcrCode Is Null And T0.DocNum = @list_of_cols_val_tab_del And T1.InvType = '13' or T1.OcrCode5 Is Null And T0.TransId = @list_of_cols_val_tab_del And T1.InvType = '13' )
BEGIN
Select @error = -1,
@error_message = 'Please Choose Branch and Department'
End
End
Hi,
As per your requirement you should use OR operator between OcrCode and OcrCode5.Kindly use the below one
IF (@OBJECT_TYPE ='24' AND (@TRANSACTION_TYPE IN('A','U')))
BEGIN
IF EXISTS(
Select T0.DocNum from ORCT T0 Inner Join RCT2 T1 On T0.DocNum=T1.DocNum
Where (isnull(T1.OcrCode,'')='' or isnull(T1.OcrCode5,'')='') And T0.DocEntry = @list_of_cols_val_tab_del
And T1.InvType = '13'
)
BEGIN
SELECT @error=100001, @error_message='Please Choose Branch and Department'
END
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.