473,241 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

Something I'm missing with condition?

Hi all,

I have the following snippet of code in my trigger
[HTML]SELECT @Currentqty = qtyonHand FROM tblProduct WHERE ProductID = @Product
SELECT @CurrentReorder = ReorderPoint FROM tblProduct WHERE ProductID = @Product
IF (@Currentqty < @CurrentReorder)
--PRINT 'Update will fire'
UPDATE tblProduct
SET qtyonHand = qtyonHand + @OrderAmt
WHERE ProductID = @Product
PRINT 'No need to order, Plenty of items are on hand.'

The following is what I'm using to add 50 ites to the qtyonHand

[HTML]UPDATE tblProduct
SET qtyonHand = qtyonHand + 50
WHERE ProductID = 1[/HTML]

What ends up happening is that the trasaction is actually firing and thus even if the condition (say 100<50) is False, 50 is still added then the PRINT fires.
What am I not seeing?

Mar 3 '07 #1
0 849

Sign in to post your reply or Sign up for a free account.

Similar topics

by: SB | last post by:
This while loop keeps repeating even when a correct character is entered.... cout<<endl<<"What day would you like to schedule the appointment?"<<endl; cout<<endl<<"Enter 'M' for Monday, 'T' for...
by: Dave | last post by:
I'm fairly new to C# and I must be misunderstanding something: I have created a standard web ASP.NET web application project and put data controls into it. Right at the top is a whole set of...
by: Tolga | last post by:
As far as I know, Perl is known as "there are many ways to do something" and Python is known as "there is only one way". Could you please explain this? How is this possible and is it *really* a...
by: Beowulf | last post by:
The problem: I'm updating a report to be "multi-language" capable. Previously, any items that had text associated with them were unconditionally pulling in the English text. The database has...
by: le0 | last post by:
Hello guys, Im really having a hard time doing this, I have a record set with the ItemNo field with the data type as Text. In the record that I have, I want to find the missing number in the...
by: danceli | last post by:
After loading the BCP files that are created during the trigger/ reporting events I've noticed that the data in the table is missing records. I've also noticed that the missing records (records in...
by: sammyboy78 | last post by:
I'm trying to create a class "WeeklyPay" that contains the methods that class "WeeklyPayTest" will use to compute the weekly pay of an employee when the user inputs employee name, hours worked, and...
by: Stef Mientki | last post by:
hello, I discovered that boolean evaluation in Python is done "fast" (as soon as the condition is ok, the rest of the expression is ignored). Is this standard behavior or is there a compiler...
by: MC | last post by:
I have a couple of customers who are using a program that deserializes an XML file, and on some files, the program fails to see the content of the file -- treats it as zero length and reports "root...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.