Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Trigger 2

Status
Not open for further replies.

Imaginecorp

IS-IT--Management
Jan 7, 2007
635
US
Why in Gods name would an Update Trigger on a table fire when I issue a Select statement? Select does not move the record pointer as far as I know and also during tests I have done, does it?

Here is the scenerio:
I have Triggers in a local table (Unit_master). The Update trigger is supposed to fire when a value in the field changes. The trigger runs a procedure in the stored procedures in the Dbc. This procedures updates the same table name (unit_master) on a remote Server.

When the unit master form is shown, it (the form) executes a method that has a select statement. This is making the Update Trigger fire when Nothing in the table has even had a chance to change. I have run the debugger, trace etc and there is nothing in the form that executes a replace.

Here is the Select statement:
Code:
	Select Unit_master.ordinal,Transform(Unit_master.unit_id) As unit_id,Unit_master.unit_type,;
		Unit_master.equip_length,Unit_master.license,Unit_master.equip_use,Unit_master.equip_status, ;
		TRANSFORM(Unit_master.ready_dt) As ready_dt,Unit_master.equip_class, ;
		TRANSFORM(Unit_master.next_maintenance) As next_maintenance,;
		TRANSFORM(Unit_master.next_inspection) As next_inspection ,;
		TRANSFORM(Unit_master.next_registeration) As next_registeration, ;
		TRANSFORM(Unit_master.hub_tot) As hub_tot ;
		FROM Unit_master ;
		WITH (Buffering = .T.) ;
		WHERE (Unit_master.org_id $ (HomeID)) ;
		AND !Deleted() &cFilterString  ;
		ORDER By &cOrderBy ;
		INTO Cursor UnitCursor

** Unit_master.org_id $ (HomeID) displays all company locations

** &cFilterString contains something like:
cFilterString = Iif(pValue1 = "<< All >>",""," AND Unit_master.unit_type = pValue1 ") &&&Pvalue1 = parameter

** &cOrderBy contains something like:
cOrderBy = "Unit_master.unit_id "

I have spent half the night and all of this morning trying to figure out why the update trigger is firing immediately after or during the Select.

Has anybody experienced this or can see anything in my code that could be the culprit.
(The select gets about 150,000 records in about .001 second so the macros are ok)
 
Did you use RowBuffering?
If so (from HELP "SELECT - SQL Command - WITH Clause")

If the cursor uses row buffering, then current record is committed before the statement is executed.



Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
BORISLAV!!!!!!!!!!!!!!

YOU DA MAN.

You are absolutely right, Never checked for buffering, it was set at Row Buffering... I have been working on this problem for about 12 hours and it never struck me to check the DE... Getting old and senile I guess.

Thank You
 
Love the ROFLMAO little ball... It is pretty funny how we sometimes miss the most obvious things. My tables always use "optomistic table buffering" and some time ago I had changed this one to 2 for testing and forget to switch it back... God I feel like an idiot, especially for the time wasted.

Borislav; Thank You again... knowing me, you saved me atleast another 12 hours...
 
Most definitely, just did not think us old timers with nothing to prove needed a star. The thank you is for saving me hours of frustration.
Even though in the cobwebs of my mind I knew about row buffering, it never struck me to check the DE as I always use table buffering as it gives me more control on the Updates.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top