?
Solved

From Access to SQL - Trigger

Posted on 2013-01-04
2
Medium Priority
?
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:PtboGiser
ID: 38745101
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 1500 total points
ID: 38745315
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
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.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

800 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