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

Columns Affected by UPDATE STATEMENT

HI,

I am writing a trigger to update table b, depending on updates on table a.
table a and b has 300 columns. I want to update only those columns which are changed by update statement like, lets say col is a column in table a
my trigger body will be
UPDATE TRIGGER ON A
OLD AS O
NEW AS N
if ( O.col <> N.co) then
update b set col = some value

end if


since i have so many columns to check, performance is very low. it takes more than 20 seconds to complete the process. Please help me out to find out a way to identify only those columns which have been updated. Is there any way? If so please let me know.


Thanks
Guru
Feb 12 '08 #1
2 1832
sakumar9
127 Expert 100+
According to your example, what I interpret is for every meaningful change in table A (old and new values are different), you want to set something in table B.

Can you give me some idea behind this scenario on what exactly you want to do?


Regards
-- Sanjay
Feb 12 '08 #2
sakumar9
127 Expert 100+
I think I got you, you want to have similar change in table B as table A (the column that is changed in A, you want similar column change in table B), so you want to compare the values of each column before and after the row is inserted to find out which column is actually updated.

Is my understanding correct??

Well in that case, I do not have idea about alternatives. But I would request you to please DO let me know if you get the solution.


Regards
-- Sanjay
Feb 12 '08 #3

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

Similar topics

0
by: Wakan | last post by:
HI, is there a way to obtain only the affected columns after an update query? After an update query, that involves 10 columns, I know that only 2 columns are really updated (because the values of...
15
by: JL | last post by:
Hi there I have a database with entries like the following: Id, Name, Goals_season, Goals_total ---------------------------------------- 5, John, 5, 23 6, Mike, 2, 14 7, Joe, 10, 34 Every...
5
by: JackT | last post by:
Hi, I have the following SQL SELECT Table1.Col1, Table3.Col1 AS Expr1, COUNT(Table1.Col2) AS Col2_No, COUNT(Table1.Col3) AS Col3_No etc, FROM Table3 INNER JOIN Table2 ON...
2
by: Gnurp Gnarp | last post by:
When the number of columns get large, it becomes increasingly difficult to view the results of a select in a small window (e.g. 80 line xterm) because of line wrapping. Can I have the results of...
9
by: allenj | last post by:
DB2 UDB 7.2 WSE Fixpak 9 Linux Red Hat 7.3 I have some library code (written in Java, if that matters) that processes maintenance screens that are presented to the end-users as forms in a...
2
by: Rich | last post by:
Hello, Is there a way to capture the Records Affected count when performing a table Update on a Sql Server table using a DataAdapter? How is this done? Thanks, Rich
2
by: BF | last post by:
Hi, I have some tables where I import data in, lots of field have gotten a NULL value which the application can not handle. Now can I replace each NULL value with '' in a columns with: update...
7
by: Lewe22 | last post by:
I am performing a series of updates from a command button on an access form. I want to record the number of records affected for each update transaction. I have simplified some code.. Private...
7
by: Norman Scheffler | last post by:
Hello, I wrote an update trigger to detect the names of the updated columns of a table using the UPDATED(columnName) function. In a stored procedure I wrote code to update user information with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.