This is a migrated thread and some comments may be shown as answers.

Insert fails with BIGINT

18 Answers 425 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
G. Deward
Top achievements
Rank 1
G. Deward asked on 20 May 2012, 01:37 PM
Please help me understand why I am receiving the following error this while attempting to insert into a table:

Failed to retrieve the automatically incremented column value from the server.
Possible reason: A trigger does not perform 'select ID from inserted' as last operation.

The DDL from the table:
CREATE TABLE [Communications].[DomainPart](
    [PartID] [bigint] IDENTITY(1,1) NOT NULL,
    [ParentPartID] [bigint] NULL,
    [PartText] [varchar](64) NOT NULL,
 CONSTRAINT [PK_DomainPart] PRIMARY KEY CLUSTERED
(
    [PartID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

The code performing the insert:
using (var context = new Data.GlobalResourcesEntitiesModel())
{
    foreach (string part in parts)
    {
        // Try to load existing item
        if (lastItem == null)
        {
            curItem = context.DomainParts.Where(p => p.ParentPartID.Equals(null) &&
                p.PartText.Equals(part, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
        }
        else
        {
            curItem = context.DomainParts.Where(p => p.ParentPartID.Equals(lastItem.ParentPartID) &&
                p.PartText.Equals(part, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
        }
 
        // If item exists then continue
        if (curItem != null)
        {
            lastItem = curItem;
            continue;
        }
 
        // Attempt to create it
        curItem = new DomainPart()
        {
            PartText = part
        };
        if (lastItem != null) { curItem.ParentPartID = lastItem.PartID; }
        context.Add(curItem);
        context.SaveChanges();
        if (curItem.PartID <= 0) { return null; }
        lastItem = curItem;
    }
}

Thanks, in advance.

- Greg D.

18 Answers, 1 is accepted

Sort by
0
G. Deward
Top achievements
Rank 1
answered on 20 May 2012, 01:59 PM
Nevermind.  The error was bogus.  Telerik SHOULD have reported a unique constraint collission.  As soon as I noticed that I was using the wrong property on the check the item was able to save correctly.
else
{
    curItem = context.DomainParts.Where(p => p.ParentPartID == lastItem.PartID &&
        p.PartText.Equals(part, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
}
0
Thomas
Telerik team
answered on 21 May 2012, 10:27 AM
Hello Greg,

thanks for reporting this issue. We've identified a path where the original exception from the server could be missed, and will fix this for the next version.

Greetings,
Thomas
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0
JAY
Top achievements
Rank 1
answered on 18 Aug 2015, 12:21 AM

Hello, we are receiving the same error after we applied MS15-058 SQL Server patch on SQL 2012. When we roll back the patch, it is working fine.

Failed to retrieve the automatically incremented column value from the server.

Possible reason: A trigger does not perform 'select ID from inserted' as last operation.​"

0
Thomas
Telerik team
answered on 19 Aug 2015, 02:25 PM
Hello Jay,

it seems you are using an older version of OpenAccess; is that information right? A colleague of mine tried to reproduce the same issue here (with installed server patch), but could not get into the problem with newer versions of OpenAccess.
In case you are using an older version, can you update and try again?

Regards,
Thomas
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
JAY
Top achievements
Rank 1
answered on 19 Aug 2015, 06:57 PM

Hello Thomas,

 Thanks for the quick reply. We are currently using version 2013.2.702.1. Is it possible your team can try using this version (with the server patch) and confirm the issue ?

 Thanks

Jay

0
Thomas
Telerik team
answered on 20 Aug 2015, 10:29 AM
Hello Jay,

we have been trying to reproduce this with the exact version that you mentioned with the server path, but we had no success in doing so. Is it possible to give us a reproduction case?

Regards,
Thomas
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
JAY
Top achievements
Rank 1
answered on 20 Aug 2015, 02:07 PM

Hello Thomas,

My colleague has already created a support ticket 962788.

We do have an environment we are able to reproduce the issue. Can we setup a web-ex so we can demo the issue ?

 Thanks

Jay

0
Thomas
Telerik team
answered on 21 Aug 2015, 08:44 AM
Hi Jay,

thanks to your colleague for sending us a reproduction code. We are looking into this and will let you know about the outcome.

Regards,
Thomas
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Thomas
Telerik team
answered on 21 Aug 2015, 03:00 PM
Hello Jay,

we identified this to be caused by a changed version format string (from the applied patch) that fools our runtime. We plan to release a fixed version (via NuGet) soon, probably during next week.

We apologize for the inconvenience this has caused.
Thomas
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Thomas
Top achievements
Rank 1
answered on 16 Sep 2015, 03:23 PM
Is this problem already been solved? We are facing exactly the same problem
0
Viktor Zhivkov
Telerik team
answered on 18 Sep 2015, 07:13 PM
Hi Thomas,

We have uploaded hotfix release for Telerik Data Access NuGet packages that you can get from www.nuget.org. The latest patched package is versioned as 2015.2.624.2. Please update all your existing Telerik Data Access packages to that version.
If you are using previous version of our NuGet packages and you have concerns about updating to the latest, please let us know so we can give you a hand in the process.

Regards,
Viktor Zhivkov
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Matt
Top achievements
Rank 1
answered on 30 Oct 2015, 11:19 PM

Hi Viktor,

Is there any prospect of a hotfix for the 2015.1.* version of Data Access to fix this for people like me who are locked into this version for the medium-term due to the scale of rework required to migrate to the new approach? I have been hit by the bigint INSERT issue out of the blue today following an upgrade of a SQL 2012 database.  I now face having to alter the datatype of the primary key on every table in the system to get things working again​.

Thanks,

Matt.

 

0
Doroteya
Telerik team
answered on 05 Nov 2015, 03:05 PM
Hello Matt,

Introducing such a patch for Data Access Q1 2015 is a topic that we intend to discuss. I'll make sure to update this thread with the appreciate information once I have it.

Thank you for your understanding.


Regards,
Doroteya
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Doroteya
Telerik team
answered on 07 Dec 2015, 11:21 AM
Hi Matt,

There's a hot fix for the Telerik.OpenAccess.Runtime assembly version 2015.1.225. You can find it attached to this message. In order to use it, you need to paste the new assembly in the install folder of Data Access on your machine and to install it in GAC (overwriting the existing one). Once you do this, make sure to clean your solution and rebuild it. Additionally, when you decide to deploy your applications make sure that they are configured as described in this blog post.

As a note, you will have to perform the same process again if you install Data Access Q1 2015 on another machine or if you re-install it.

I hope this helps. Let me know if you have further questions.


Regards,
Doroteya
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Daniel
Top achievements
Rank 2
answered on 22 Jul 2016, 08:28 AM

Dear support,

we're currently referencing version 2012.2.607.1 of the Telerik.OpenAccess assemblies in our projects.

Now we're faced with the identical effect when installing the Windows Update KB3162659.
As you point out in the readme file of the hotfix, the issue is not limited to this specific Windows Update. Any update for different SQL server versions that converts the SQL version format string to the not supported forma, breaks the Telerik runtime.

Is there also a hotfix for the mentioned assembly version 2012.2.607.1.
Are there other options of how to overcome this issue besides updating to Telerik version 2015 and then apply the hotfix?

Please let me know, if you require more detailed information.

Best regards,

Markus

0
ES
Top achievements
Rank 1
answered on 22 Jul 2016, 11:52 AM

Dear support,

 

we are also using 2012.2.628.2 - and getting this error now on a SQL 2008 R2 (10.50.6542)

If you have any recommendations in upgrading, go ahead. We use a single context for the whole lifetime in a WinForms UI - somebody told me that this is a problem.

We also rely on the designer heavily ... so we have to use the last version where designer is supported.

 

Thanks in advance!

0
Doroteya
Telerik team
answered on 27 Jul 2016, 11:04 AM
Hi,

Our general recommendation for situations like those you describe is to upgrade Data Access to at least Data Access Q1 2015, and to install the available hotfix (more details are available in this forum post). Note that, although there's a hotfix for this version it supports Visual Studio up to version 2013.

The more permanent solutions that will allow you to update your applications in a more convenient way in the feature are described in the options listed in this forum post.

I hope this helps.

Regards,
Doroteya
Telerik by Progress
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
Jeff
Top achievements
Rank 1
answered on 22 Feb 2017, 01:38 PM

Is it possible at all to have this hotfix and its details more visible?  I've been casting about for a week trying to find a solution to this exact issue after 3 different versions of my product started failing on SQL 2012.  I overlooked this thread multiple times because the thread wasn't originally about this issue and seemed to be a user error.  It was only as a last resort that I finally read down through and realized the thread had been repurposed for exactly my issue and had the solution all along.

At the very least a message or something that would appear in users' Telerik account page or downloads stating 'If on SQL 2012 and inserts fail with Telerik prior to Data Access Q1 2015' or similar would be greatly helpful to other customers who may encounter this and be unable to immediately move to a fluent model.

Tags
Databases and Data Types
Asked by
G. Deward
Top achievements
Rank 1
Answers by
G. Deward
Top achievements
Rank 1
Thomas
Telerik team
JAY
Top achievements
Rank 1
Thomas
Top achievements
Rank 1
Viktor Zhivkov
Telerik team
Matt
Top achievements
Rank 1
Doroteya
Telerik team
Daniel
Top achievements
Rank 2
ES
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Share this question
or