Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to know which column updated Expand / Collapse
Author
Message
Posted Tuesday, November 27, 2012 4:46 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 1:54 PM
Points: 46, Visits: 252
Hi,

I have one Customer Table which contains more than 25 columns.

When user Updated any column in customer table.

Example: if he is updated Address,City. or

If he is updated Address , City , Country , ZipCode

I want the Updated Column value will be inserterd into another table .

Please help me.

Thanks,
Post #1389467
Posted Tuesday, November 27, 2012 9:42 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 18, 2013 1:47 AM
Points: 196, Visits: 87
Please try trigger for that particular table.

tr_TableName_After_Insert

create trigger [dbo].[tr_TableName_After_Insert]
on [dbo].[TableName]
after insert
as
begin
(your operation to insert into different table)
end

Post #1389502
Posted Wednesday, November 28, 2012 3:59 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 1:54 PM
Points: 46, Visits: 252
Thanks for your reply.

But i want when the user updating any fileds in the table , only those fileds i need to insert into another table.

So i can know only these fileds are updated in that table.

Thanks,
Post #1390181
Posted Wednesday, November 28, 2012 4:40 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 11:31 AM
Points: 36,728, Visits: 31,180
suresh0534 (11/28/2012)
Thanks for your reply.

But i want when the user updating any fileds in the table , only those fileds i need to insert into another table.

So i can know only these fileds are updated in that table.

Thanks,


What does the original customer table and destination tables look like?


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1390198
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse