473,387 Members | 1,504 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,387 software developers and data experts.

How to identify the ID of row which has been modified?

Hi all,

I have table Demo:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE Demo
  2. (
  3. ID               int              PRIMARY KEY,
  4. Name         char(50),
  5. BeModified  int             DEFAULT(0)
  6. )
Whenever [Name] is updated, [BeModified] will be set to 1.

I think I should create an TRIGGER AFTER UPDATE

Expand|Select|Wrap|Line Numbers
  1. CREATE TRIGGER UpdateRow
  2.  
  3. ON Demo
  4.  
  5. AFTER UPDATE
  6.  
  7. UPDATE Demo
  8.  
  9. Set BeModified = 1 WHERE ID = "???"
  10.  
My problem is I do not know how to identify the ID of row which has been modified.

Have you got any suggestion for me?

Thank you so much!
Dec 13 '09 #1

✓ answered by ck9663

Use the DELETED and INSERTED tables.

Happy Coding!!!

--- CK

3 1307
ck9663
2,878 Expert 2GB
Use the DELETED and INSERTED tables.

Happy Coding!!!

--- CK
Dec 13 '09 #2
I am sorry to bother you but could you explain it more specific?

I did something to understand more about inserted & deleted table, but I get the message "Invalid object name 'inserted'."
Dec 14 '09 #3
I did it, just by using inserted table.

Thanks for your helping!
Dec 14 '09 #4

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

Similar topics

8
by: DraguVaso | last post by:
Hi, I want my application do different actions depending on the exception it gets. For exemple: I have an SQL-table with a unique index. In case I try to Insert a record that's alreaddy in it I...
4
by: kevin.hall | last post by:
I've got a problem where I have to identify differences in network. The network may have different types of nodes and may only have a string of ring-like topology: Code: A--B--C--D--E or
2
by: Justin | last post by:
I have a simple VB form with many controls. When user add/modify a record....if the user click the form close button...system should show a messagebox that "something is modified. Do you really...
4
by: Goh | last post by:
Hi, I would like to know how can we implement a web page that intelligent enough to unique identify that pc have been visit before without any cookies and login user require. I have try...
12
by: sandravandale | last post by:
It's important that I can read the contents of the dict without flagging it as modified, but I want it to set the flag the moment I add a new element or alter an existing one (the values in the...
3
by: Michel | last post by:
Hi, I wrote an app in .Net and I whant only 1 instance of this app open for the user; the user open my app, do some works and try to open another instance of my app, I whant to show a message to...
102
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem...
7
by: exapplerep | last post by:
I teach a class in MS Access 2003 to college students. I've had some issues with students turning in .mdb files that were created by other students and then only slightly modified to give some...
4
by: MLH | last post by:
I'm thinking of an integer field in which I could write values up to 1+2+4+8+16+32+64 and to use these values later. Each of the individual values would represent a weekday from Sunday to Saturday....
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.