Click here to Skip to main content
15,897,187 members
Home / Discussions / Database
   

Database

 
QuestionJoin Query returning duplicated rows Pin
devenv.exe15-May-14 23:13
professionaldevenv.exe15-May-14 23:13 
AnswerRe: Join Query returning duplicated rows Pin
Mycroft Holmes16-May-14 13:20
professionalMycroft Holmes16-May-14 13:20 
AnswerRe: Join Query returning duplicated rows Pin
NitinDhapte6-Jun-14 23:07
NitinDhapte6-Jun-14 23:07 
QuestionTranspose multiple rows into multiple columns in SQL Server Pin
Davidemazzuuu13-May-14 4:52
Davidemazzuuu13-May-14 4:52 
AnswerRe: Transpose multiple rows into multiple columns in SQL Server Pin
Corporal Agarn13-May-14 5:46
professionalCorporal Agarn13-May-14 5:46 
GeneralRe: Transpose multiple rows into multiple columns in SQL Server Pin
Davidemazzuuu13-May-14 21:11
Davidemazzuuu13-May-14 21:11 
AnswerRe: Transpose multiple rows into multiple columns in SQL Server Pin
Mycroft Holmes13-May-14 12:53
professionalMycroft Holmes13-May-14 12:53 
GeneralRe: Transpose multiple rows into multiple columns in SQL Server Pin
Davidemazzuuu13-May-14 21:04
Davidemazzuuu13-May-14 21:04 
GeneralRe: Transpose multiple rows into multiple columns in SQL Server Pin
Mycroft Holmes13-May-14 21:30
professionalMycroft Holmes13-May-14 21:30 
GeneralRe: Transpose multiple rows into multiple columns in SQL Server Pin
Davidemazzuuu13-May-14 22:27
Davidemazzuuu13-May-14 22:27 
GeneralRe: Transpose multiple rows into multiple columns in SQL Server Pin
Member 1026233013-May-14 21:34
Member 1026233013-May-14 21:34 
QuestionSQL Server 2012 Cube Build failing. Pin
rnbergren12-May-14 9:52
rnbergren12-May-14 9:52 
QuestionAccess DB Pin
Zeyad Jalil11-May-14 19:45
professionalZeyad Jalil11-May-14 19:45 
AnswerRe: Access DB Pin
Bernhard Hiller11-May-14 22:30
Bernhard Hiller11-May-14 22:30 
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 

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.