SQL Server Exception Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In SQL Server, if an attempt is made to input to the database a record with
an id number that already exists, what exception is generated?

Thanks,
Fred
 
All exceptions thrown by the DB will be SqlExceptions - the message will be
something like System.Data.SqlClient.SqlException: Violation of PRIMARY KEY
constraint 'Key_Name'. Cannot insert duplicate key in _____
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top