That's it Neil just keep on side stepping.
Why do I have the Muppets theme tune in my head all of a sudden..

--
Snake

-----Original Message-----
From: Robertson-Ravo, Neil (RX)
[mailto:[EMAIL PROTECTED] 
Sent: 18 August 2005 15:19
To: CF-Talk
Subject: RE: @@Identity returns excessive records

YOU NEVER log onto a DB and do this - apart from locking the table (which
will happen) it is completely and utterly reckless.



-----Original Message-----
From: Russ Michaels [mailto:[EMAIL PROTECTED]
Sent: 18 August 2005 15:25
To: CF-Talk
Subject: RE: @@Identity returns excessive records

Neil,

So your saying that if I logged into the database using enterprise manager
and edited a field in a specific row, that this stored procedure would
magically detect this and execute itself just as a trigger would.

--

Snake

-----Original Message-----
From: Robertson-Ravo, Neil (RX)
[mailto:[EMAIL PROTECTED]
Sent: 18 August 2005 15:09
To: CF-Talk
Subject: RE: @@Identity returns excessive records

And you are not looking into the issue here: - this is not CF related so
this will be my last post on the subject - and it is entirely possible to do
what you seem as being the impossible.

To answer your Q in pseudo code (it is not difficult to grasp).

A) You are updating a record WITH an sp (lets call it usp_updateandlog)
B) You know the update is passing in a records status.
C) Check the original value of records status and flag a boolean value of
bHasChanged
D) perform update
E) get status of update (within transaction)
F) check bHasChanged
G) If true, perform audit log and/or other related task.

Job done. I am sure you can fill the fluff in where other values are
required.


But to give you some code you can do this.
========================
create table t ( i int not null );
create table t_audit ( old_i int not null, new_i int null ); insert into t
(i) values( 1 ); insert into t (i) values( 2 );
 
update t
   set i  = i + 1
output deleted.i, inserted.i into t_audit  where i = 1;
 
delete from t
output deleted.i, NULL into t_audit
 where i = 2;
 
select * from t;
select * from t_audit;
 
drop table t, t_audit;
go

albeit SQL Server 2005 alone.
This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions.
Visit our website at http://www.reedexpo.com







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:215615
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to