Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

sql CLR trigger causing havoc in Access linked table

 
   Database Help (Home) -> Programming RSS
Next:  referencing multiple databases in .net for a stor..  
Author Message
Lew Burrus

External


Since: Feb 15, 2007
Posts: 1



(Msg. 1) Posted: Thu Feb 15, 2007 3:31 pm
Post subject: sql CLR trigger causing havoc in Access linked table
Archived from groups: microsoft>public>sqlserver>programming (more info?)

Have been running an Access front end (mdb)
on a SQL Server back end for several years.
Will soon be migrating to SQL2005. Have
detected a showstopper of a problem.

Some background:
One reason to move to SQL05 is the use of CLR
for a generic audit trigger (based on code
made available by others). Trigger works
well. For an example, see
http://www.sqlservercentral.com/columnists/dziffer/creatingagenericaud...riggerw

Here’s the problem: when Access inserts a
new row in a linked, audited table, SQL
should return the ID (identity) of the new
record, and then Access can refresh that row
– the ID field’s value and field value with
defaults should be available to the Access
table. However, when the CLR trigger fires,
SQL returns the ID of the row from the audit
table, not the table where the original
insert occurred. So, if I am inserted my
200th record into table1, and this creates a
49th record in my audit table, AND table1
contains a record where ID=49, then the
Access table will change its current record
to row where ID=49. The new record still
gets inserted correctly; the trigger fires
correctly; the problem is solely how Access
represents the current/new record. I
probably don’t need to explain the danger of
having the current record flip on a user
without notice.

Anyway, am assuming this might be related to
difference between @@identity and
scope_identity(), but am not able to tell.
What’s curiouser, if the id returned by the
audit table is not found in table1, then
Access behaves as it should.

Any advice on how to proceed? Or do I need
to backtrack, and implement a purely SQL
solution? Is anyone from Microsoft out there
who understands why is occurring?

Lew

 >> Stay informed about: sql CLR trigger causing havoc in Access linked table 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Trigger getting fired multi-times for Linked Table Insert? - I have a MS Access front end from which I do a insert into a linked table on SQL server. Basically I get the data from the frontend ( excel template) and store it on a access table. I insert this data into a sql table A. But there is a INSERT trigger....

linked server trigger problem - I have a trigger that uses subqueries to update some fields. We moved to a new server and setup linked servers. I added ansi_nulls and ansi_warnings as below. I still get the error which must be from subqueries. I have tried setting an Heterogeneous...

Creating a Trigger which updates a linked server - Hi all, I read some message in FAQ about my problem but i doesn't work any more... I have 2 SQL-Servers that use sql-server and windows security integrity. On first Server, i add a linkServer to the other by using sp_addlinkedserver and use a specifie...

update trigger on a table - Hi I have a table where two fields together is unik id. On the table I have a update trigger that is updating a date field. The trigger goes like this: Update table1 set date1 = getdate() where id1= (select id1 from inserted) and id2=(select id2 from..

Trigger for dup record in other table on insert - Triggers Test in other table I want to develop a trigger for a class table in which on insert I want to test if there is a dup record in another table which is a manager requested table Table one: CourseCompleted Table Two: IDP (development plan) O...
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]