on 09-30-2014 3:13 PM
hi experts
I am trying to set up Stored procedure to prevent mistakes in discounts for BP on SO & QU.
I am struggling with getting query correct for my requirement.
This BP has 2 options for discount - discount must be either 5.5% or -5% (Null is not allowed either)
I think I understand problem is that the red condition below must always be TRUE therefore SP is always blocking.
but my knowledge of SQL is not adequate to correct this.
I have tried different operators 'NOT IN' and 'LIKE' but I am still unsuccessful
Please can someone advise solution?
IF (@object_type='17' OR @object_type='23') and @transaction_type IN ('A','U')
BEGIN
If Exists (Select T0.DocEntry from [dbo].[ORDR] T0 Inner Join RDR1 T1 On T0.DocEntry=T1.DocEntry
Where T0.DocEntry = @list_of_cols_val_tab_del AND (T1.DiscPrcnt != -5.00 OR T1.DiscPrcnt !=+5.50) AND T0.CardCode = 'CDBI002')
BEGIN
Select @error = -1,
@error_message = 'Remember special discount for this BP'
End
End
Thanks for any assistance
Regards,
karen
Hi Andrew,
Try this:
IF (@object_type='17' OR @object_type='23') and @transaction_type IN ('A','U')
BEGIN
If Exists (Select T0.DocEntry from [dbo].[ORDR] T0 Inner Join RDR1 T1 On T0.DocEntry=T1.DocEntry
Where T0.DocEntry = @list_of_cols_val_tab_del AND T0.CardCode = 'CDBI002' AND (T1.DiscPrcnt not in (-5, 5.5) ))
BEGIN
Select @error = -1,@error_message = 'Remember special discount for this BP'
End
End
It works
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
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.