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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Errror 25016 - Inside this message

Status
Not open for further replies.

Laffern

Programmer
Dec 6, 2004
18
AT
I got the error 25016 while inserting into a table.

The solution from the msdn:

Ensure that no duplicate key violations have occurred.
Such violations may occur when users insert records into a table with an identity column. SQL Server CE remote data access (RDA) does not manage identity columns when a table is pulled.

Or

Ensure that a replication publication is configured to manage identity columns for a table(s) in the publication.



My question:
What is the problem with an identity column ? Yes, I am using RDA, but problems occurs with one table only. How can I disable an identity column ? This isn't a primary key isn't it ?

But more interesting is the second solution from the msdn. Where can I enable "Identity Columns Management" ?

Thanks in advance for possible solutions.
 
look at set indentitiy_insert in BOL and maybe also IDENTITY (Function)

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Is there a way to find out which column is an identity one ?
 
if you script the table in QA - right click the table and select script object to new window as CREATE - you should see it in the script - alternatively in Enterprise Manager right click the table and select design - then select each field and down the bottom there is a part that says if the column is identity.

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
That's strange. Each table has rows with NO identity.
 
This error can be returned when the user attempts to insert a row with an automatically incremented Identity column. With RDA, this usually occurs when a user pulls rows from the server and attempts to insert new rows before setting the seed and increment values for the Identity column. By default, the seed and increment values are both 1.

To correct this error, set the seed to the next highest number after the table is pulled, before allowing users to enter data.

you can use IDENT_CURRENT
Returns the last identity value generated for a specified table in any session and any scope.

Syntax
IDENT_CURRENT('table_name')

Then add to this the result of IDENT_INCR
Returns the increment value (returned as numeric(@@MAXPRECISION,0)) specified during the creation of an identity column in a table or view that has an identity column.

Syntax
IDENT_INCR ( 'table_or_view' )

to know that the seed will be ok

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Laffern said:
My question:
What is the problem with an identity column ? Yes, I am using RDA, but problems occurs with one table only. How can I disable an identity column ? This isn't a primary key isn't it ?

To answer the last question, No, an Identity column is not quite the same thing as a Primary Key. It can be (and often is) used as one. However, you can have Identity columns without using them as indexes or primary keys. Identity is a value that increments automatically based, as others have said, on what number you enter as the Increment and *starts* on the number you enter as Seed.

You can start an Identity column on 432 and increment by 6 and the next value generated will be 438.



Catadmin - MCDBA, MCSA
Remember, "Work" is a four letter word. And you know what your mother told you about using four letter words!
 
How many columns does that table have?
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top