473,763 Members | 6,149 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access Bug with SQL Server identity columns

I don't know if this has been reported before but it appears to be a
bug with Access.

If I create two tables both with an identity column then create an
insert trigger on table1 that inserts a related record into table2, now
create a form on table1 with a subform on table2. Insert records into
the main form to your heart's content and everything's fine, each main
record automatically gets a child record and so far the identity
columns are nice and sequential with no gaps, which is good for testing
the next bit (gaping holes in the sequentialness might not show up the
problem easily)

Now truncate table2 (note: use truncate table so that the identity seed
is reset)

Now enter a new record into the form, when it saves, it will jump back
to record 1, well actually it thinks (according to the nav bar) it's on
the last record but the data is from the record with the id of 1. do it
again it will jump to record 2, etc.

What's happening here is that Access appears to be retrieving
@@IDENTITY from the server and that contains the ID of table2 that was
inserted by the trigger. If the id of table2 doesn't exist in table1,
then the main form stays at the record just inserted (strange, I
predicted it would go all #deleted on me).

The problem only arises if the trigger inserts an ID into the sub table
that also exists as an ID in the main table so you can see you might
never come across the problem.

I can't say what Access does internally but it appears it's using
@@IDENTITY when a fix for this would be for it to use SCOPE_IDENTITY( ).

So I have a bug, probable cause and a fix, who do I send that to that
doesn't want to charge me £70 for the privilege?

Nov 13 '05 #1
17 3593
ADP or MDB and ODBC/whatever?

Nov 13 '05 #2
ADP or MDB and ODBC/whatever?

Nov 13 '05 #3
On 5 Aug 2005 03:25:29 -0700, "Trevor Best"
<go**********@b esty.org.uk> wrote:

Try to reproduce using the beta version of SQL Server 2005. Then maybe
MSFT would be interested. I'm pretty sure there is a way to
participate in the beta program.
OTOH this may be strictly an Access bug, and not a SQL Server one.

Were your tables in a 1:M relation? That's what subforms are most
often used for.

-Tom.
I don't know if this has been reported before but it appears to be a
bug with Access.

If I create two tables both with an identity column then create an
insert trigger on table1 that inserts a related record into table2, now
create a form on table1 with a subform on table2. Insert records into
the main form to your heart's content and everything's fine, each main
record automatically gets a child record and so far the identity
columns are nice and sequential with no gaps, which is good for testing
the next bit (gaping holes in the sequentialness might not show up the
problem easily)

Now truncate table2 (note: use truncate table so that the identity seed
is reset)

Now enter a new record into the form, when it saves, it will jump back
to record 1, well actually it thinks (according to the nav bar) it's on
the last record but the data is from the record with the id of 1. do it
again it will jump to record 2, etc.

What's happening here is that Access appears to be retrieving
@@IDENTITY from the server and that contains the ID of table2 that was
inserted by the trigger. If the id of table2 doesn't exist in table1,
then the main form stays at the record just inserted (strange, I
predicted it would go all #deleted on me).

The problem only arises if the trigger inserts an ID into the sub table
that also exists as an ID in the main table so you can see you might
never come across the problem.

I can't say what Access does internally but it appears it's using
@@IDENTITY when a fix for this would be for it to use SCOPE_IDENTITY( ).

So I have a bug, probable cause and a fix, who do I send that to that
doesn't want to charge me £70 for the privilege?


Nov 13 '05 #4
On 5 Aug 2005 03:25:29 -0700, "Trevor Best"
<go**********@b esty.org.uk> wrote:

Try to reproduce using the beta version of SQL Server 2005. Then maybe
MSFT would be interested. I'm pretty sure there is a way to
participate in the beta program.
OTOH this may be strictly an Access bug, and not a SQL Server one.

Were your tables in a 1:M relation? That's what subforms are most
often used for.

-Tom.
I don't know if this has been reported before but it appears to be a
bug with Access.

If I create two tables both with an identity column then create an
insert trigger on table1 that inserts a related record into table2, now
create a form on table1 with a subform on table2. Insert records into
the main form to your heart's content and everything's fine, each main
record automatically gets a child record and so far the identity
columns are nice and sequential with no gaps, which is good for testing
the next bit (gaping holes in the sequentialness might not show up the
problem easily)

Now truncate table2 (note: use truncate table so that the identity seed
is reset)

Now enter a new record into the form, when it saves, it will jump back
to record 1, well actually it thinks (according to the nav bar) it's on
the last record but the data is from the record with the id of 1. do it
again it will jump to record 2, etc.

What's happening here is that Access appears to be retrieving
@@IDENTITY from the server and that contains the ID of table2 that was
inserted by the trigger. If the id of table2 doesn't exist in table1,
then the main form stays at the record just inserted (strange, I
predicted it would go all #deleted on me).

The problem only arises if the trigger inserts an ID into the sub table
that also exists as an ID in the main table so you can see you might
never come across the problem.

I can't say what Access does internally but it appears it's using
@@IDENTITY when a fix for this would be for it to use SCOPE_IDENTITY( ).

So I have a bug, probable cause and a fix, who do I send that to that
doesn't want to charge me £70 for the privilege?


Nov 13 '05 #5
MDB/ODBC

Nov 13 '05 #6
MDB/ODBC

Nov 13 '05 #7
Originally 1:n when first found, my test database I built didn't have
the relationship in

Nov 13 '05 #8
Originally 1:n when first found, my test database I built didn't have
the relationship in

Nov 13 '05 #9
> Try to reproduce using the beta version of SQL Server 2005

I have the beta, when I restore a database into it from 2000, only half
the database gets restored, tables have missing data, some tables
missing, right mess. They might want to address the fundimental issues
like that before the obscure ones like my OP :-)

I'm pretty sure it's an Access bug anyway, if I insert using Query
Analyser, both @@IDENTITY and SCOPE_IDENTITY( ) return the expected
values, i.e. @@IDENTITY returns the ID from table2 and SCOPE_IDENTITY( )
returns the ID of table1.

Same thing in ADP or MDB so would suggest Access and not any of it's
middleware like ODBC/ADO/DAO, etc.

Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

112
10356
by: Andy | last post by:
Hi All! We are doing new development for SQL Server 2000 and also moving from SQL 7.0 to SQL Server 2000. What are cons and pros for using IDENTITY property as PK in SQL SERVER 2000? Please, share your experience in using IDENTITY as PK .
4
3918
by: Fabian von Romberg | last post by:
Hi, I have installed Sql Reporting Services on 2 machines, one is WIN 2000 PRO and the other one is WIN 2000 ADV. SERVER. When I try to access a report using the webbrowser, I get the following error, this happens only if try access the report on the SERVER, it I try on my local machine, it works just fine. Any help will be much appreciated. Thanks in advance, Fabian von Romberg
2
1715
by: meyvn77 | last post by:
Background: I'm new at SQL Server (no experience, zip, nada) but getting pretty good with developing applications in Access(VBA) and in VB using ADO.... Currently I use access to and GIS software to build data management systems. I have become pretty proficient in programming these systems in Access but a client would like their system to be on an existing SQL server. I understand one way to go would be to develop the GUI in VB and hit
0
431
by: Trevor Best | last post by:
I don't know if this has been reported before but it appears to be a bug with Access. If I create two tables both with an identity column then create an insert trigger on table1 that inserts a related record into table2, now create a form on table1 with a subform on table2. Insert records into the main form to your heart's content and everything's fine, each main record automatically gets a child record and so far the identity columns...
42
11556
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
17
2496
by: DaveG | last post by:
Hi all I am planning on writing a stock and accounts program for the family business, I understand this is likely to take close to 2 years to accomplish. The stock is likely to run into over a thousand items and the accounting side will be used for hopefully many years so the entries are likely to be vast. The delema is what is best to use ase the DB engine, Access I have as part of Office 2002 or should I really be looking at SQL...
15
4742
by: Marcus | last post by:
I created a VB.Net 1.1 application that iterates through all the tables in any basic Access 2000 database passed to it and generates the same table structure in a SQL Server Express database. The structure is created fine (with minor data conversions from one to the other, e.g. yes/no --> bit, memo --> text, etc). My problem now is transferring the data over from Access to SQL Server. I thought it would be a fairly straight forward...
6
5580
by: royan | last post by:
Help please! I have the same problem which this post http://groups.google.com/group/microsoft.public.vsnet.vstools.office/browse_thread/thread/91275741fa1e100f/164638c6d6ba3872?lnk=gst&q=System.UnauthorizedAccessException%3A+Access+is+denied.&rnum=1&hl=en#164638c6d6ba3872 When I deploy our ASP.NET Application web form to Windows server 2003 I got access deny error. We are using the Microsoft.Office.Interop.Word COM DLL. We need to read a...
2
1971
by: Dave | last post by:
I have a web app that needs to access a folder on a different server. The other server "IS" on a domain. I tried using DirectoryInfo, even with a Virtual Directory, only to find that it pertains to the local box. Can anyone point me in the direction of being able to access the file struction on another server? Thanks
0
9563
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10144
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9937
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.