Solved

From Access to SQL - Trigger

Posted on 2013-01-04
2
228 Views
Last Modified: 2013-01-07
I have what was a simple Update Query in Access to what i am thinking should be a After update\insert Trigger in SQL.
Access Query
UPDATE SEGMENT SET SEGMENT.LeftOdd = 1
WHERE ([L_F_add] mod 2) = 1 OR  ([L_F_add] = 0 AND [R_F_add] > 0 AND ([R_F_add] mod 2) = 0);

Open in new window


Im not sure how to determine if the L_T_ADD value = odd number or the L_F_ADD value = oddnumber statement should work.
Suggestions
It looks like this "x % 2" would be the way?
Thanks
0
Comment
Question by:PtboGiser
2 Comments
 

Author Comment

by:PtboGiser
Comment Utility
Then if L_F_ADD or L_R_ADD is odd then i need to set the LEFTODD column to a value of "1"
0
 
LVL 12

Accepted Solution

by:
Jared_S earned 500 total points
Comment Utility
It looks like you've already got it.

CREATE TRIGGER myTrigger
ON SEGMENT
AFTER INSERT, UPDATE
AS

UPDATE SEGMENT
SET SEGMENT.LeftOdd = 1
WHERE (([L_F_add] % 2) = 1
OR  
([L_F_add] = 0 AND [R_F_add] > 0 AND ([R_F_add]%2) = 0));
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now