Click here to Skip to main content
15,886,578 members
Home / Discussions / Database
   

Database

 
AnswerRe: Access DB Pin
sankarsan parida12-May-14 19:33
professionalsankarsan parida12-May-14 19:33 
Questionhow to return primary key when insert statement violates unique constraint Pin
Nico Haegens10-May-14 7:21
professionalNico Haegens10-May-14 7:21 
AnswerRe: how to return primary key when insert statement violates unique constraint Pin
PIEBALDconsult10-May-14 7:44
mvePIEBALDconsult10-May-14 7:44 
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
Nico Haegens10-May-14 8:05
professionalNico Haegens10-May-14 8:05 
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
PIEBALDconsult10-May-14 10:22
mvePIEBALDconsult10-May-14 10:22 
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
Nico Haegens10-May-14 23:07
professionalNico Haegens10-May-14 23:07 
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
PIEBALDconsult11-May-14 5:56
mvePIEBALDconsult11-May-14 5:56 
AnswerRe: how to return primary key when insert statement violates unique constraint Pin
jschell11-May-14 8:17
jschell11-May-14 8:17 
Nico Haegens wrote:
I would like to know how to return the primary key(the column is always called id) ...All my insert statements are in stored procedures


Write a lot of code - duplicating every constraint that you have. In every stored procedure that does an insert. So if you have a unique name constraint in your customer table then your insert for the customer first checks to see that the name is unique. If it isn't then it throws an error. If it is then it proceeds to doing the actual insert. Course you might want to create a table transaction as well since someone could insert a different row with the name as well.

Naturally this isn't efficient. Nor performant. Applications should be coded to prevent this in the first place rather than relying on the database to provide error notification (versus error prevention.)
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
Nico Haegens12-May-14 3:20
professionalNico Haegens12-May-14 3:20 
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
Richard.Berry10012-May-14 7:55
Richard.Berry10012-May-14 7:55 
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
Eddy Vluggen12-May-14 8:49
professionalEddy Vluggen12-May-14 8:49 
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
Corporal Agarn12-May-14 9:45
professionalCorporal Agarn12-May-14 9:45 
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
jschell12-May-14 10:31
jschell12-May-14 10:31 
AnswerRe: how to return primary key when insert statement violates unique constraint Pin
Mycroft Holmes12-May-14 22:25
professionalMycroft Holmes12-May-14 22:25 
AnswerRe: how to return primary key when insert statement violates unique constraint Pin
Nico Haegens13-May-14 2:18
professionalNico Haegens13-May-14 2:18 
GeneralRe: how to return primary key when insert statement violates unique constraint Pin
Mycroft Holmes13-May-14 12:52
professionalMycroft Holmes13-May-14 12:52 
QuestionDatabase SQL Pin
Syafiqah Zahirah10-May-14 4:47
Syafiqah Zahirah10-May-14 4:47 
AnswerRe: Database SQL Pin
Peter Leow10-May-14 5:24
professionalPeter Leow10-May-14 5:24 
GeneralRe: Database SQL Pin
Syafiqah Zahirah11-May-14 3:43
Syafiqah Zahirah11-May-14 3:43 
AnswerRe: Database SQL Pin
Peter Leow11-May-14 4:13
professionalPeter Leow11-May-14 4:13 
GeneralRe: Database SQL Pin
Syafiqah Zahirah11-May-14 4:45
Syafiqah Zahirah11-May-14 4:45 
GeneralRe: Database SQL Pin
Syafiqah Zahirah15-May-14 6:50
Syafiqah Zahirah15-May-14 6:50 
GeneralRe: Database SQL Pin
Peter Leow15-May-14 14:47
professionalPeter Leow15-May-14 14:47 
QuestionArithmetic rounding Pin
Richard.Berry1009-May-14 11:04
Richard.Berry1009-May-14 11:04 
AnswerRe: Arithmetic rounding Pin
Richard Andrew x649-May-14 12:26
professionalRichard Andrew x649-May-14 12:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.