Friday, March 30, 2012

New to SQL and need help

I am running a program that was created in VB that takes data from a
scanned file and inserts it into our database. We have the column
student id as the primary key and it is decremented every time it goes
through the program so they are each unique and never overlap. The
program has been working fine but recently when I run it I get a
primary key violation. I thought that the identity might have gotten
out of sync and tried CheckIdent but still no luck. I came to find
out that the primary key does not have an identity and so I am not
sure why it will not let me insert the data.It is just that the value you are trying to insert already exists.

--
Posted via http://dbforums.com|||I've looked at the table that I am trying to insert into and did a query
for numbers that overlapped and it returned nothing.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||Hightower130 (bowens@.webebi.com) writes:
> I am running a program that was created in VB that takes data from a
> scanned file and inserts it into our database. We have the column
> student id as the primary key and it is decremented every time it goes
> through the program so they are each unique and never overlap. The
> program has been working fine but recently when I run it I get a
> primary key violation. I thought that the identity might have gotten
> out of sync and tried CheckIdent but still no luck. I came to find
> out that the primary key does not have an identity and so I am not
> sure why it will not let me insert the data.

And since I don't see your database, your input file, your VB code etc,
neither can I tell what went wrong.

It is possible that if you posted some code that it would help, but
since you have the existing data, and the problem appears to be
reproducible - how about debugging it?

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

No comments:

Post a Comment