Click here to Skip to main content
15,899,679 members
Home / Discussions / Database
   

Database

 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Trekstuff15-Mar-12 9:10
Trekstuff15-Mar-12 9:10 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
jschell16-Mar-12 11:25
jschell16-Mar-12 11:25 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Trekstuff16-Mar-12 11:37
Trekstuff16-Mar-12 11:37 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
jschell17-Mar-12 7:35
jschell17-Mar-12 7:35 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Eddy Vluggen15-Mar-12 9:57
professionalEddy Vluggen15-Mar-12 9:57 
AnswerRe: What's the best way to temporarily persist results of a long running SP? Pin
R. Giskard Reventlov14-Mar-12 8:54
R. Giskard Reventlov14-Mar-12 8:54 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Trekstuff14-Mar-12 9:42
Trekstuff14-Mar-12 9:42 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
R. Giskard Reventlov14-Mar-12 10:02
R. Giskard Reventlov14-Mar-12 10:02 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Trekstuff14-Mar-12 10:26
Trekstuff14-Mar-12 10:26 
SuggestionRe: What's the best way to temporarily persist results of a long running SP? Pin
foxyland14-Mar-12 20:21
foxyland14-Mar-12 20:21 
GeneralRe: What's the best way to temporarily persist results of a long running SP? Pin
Trekstuff15-Mar-12 9:12
Trekstuff15-Mar-12 9:12 
QuestionBest way to get PK value of newly created record Pin
Aaron Hartley13-Mar-12 4:19
Aaron Hartley13-Mar-12 4:19 
AnswerRe: Best way to get PK value of newly created record Pin
Shameel13-Mar-12 5:16
professionalShameel13-Mar-12 5:16 
GeneralRe: Best way to get PK value of newly created record Pin
Aaron Hartley13-Mar-12 5:40
Aaron Hartley13-Mar-12 5:40 
AnswerRe: Best way to get PK value of newly created record Pin
Luc Pattyn13-Mar-12 5:48
sitebuilderLuc Pattyn13-Mar-12 5:48 
GeneralRe: Best way to get PK value of newly created record Pin
Shameel13-Mar-12 6:09
professionalShameel13-Mar-12 6:09 
AnswerRe: Best way to get PK value of newly created record Pin
PIEBALDconsult13-Mar-12 14:07
mvePIEBALDconsult13-Mar-12 14:07 
GeneralRe: Best way to get PK value of newly created record Pin
Shameel13-Mar-12 19:33
professionalShameel13-Mar-12 19:33 
GeneralRe: Best way to get PK value of newly created record Pin
PIEBALDconsult14-Mar-12 3:11
mvePIEBALDconsult14-Mar-12 3:11 
GeneralRe: Best way to get PK value of newly created record Pin
jschell14-Mar-12 8:50
jschell14-Mar-12 8:50 
AnswerRe: Best way to get PK value of newly created record Pin
Mycroft Holmes13-Mar-12 19:52
professionalMycroft Holmes13-Mar-12 19:52 
AnswerRe: Best way to get PK value of newly created record Pin
Bernhard Hiller13-Mar-12 21:53
Bernhard Hiller13-Mar-12 21:53 
First of all, separate the serial number and the primary key. If you use a Guid as the key, you can "calculate" it (Guid.NewGuid()) already on the client. In case of an autoincrement value, you can query it from the database with a SELECT @@ID.
Your serial number column should still have a unique index.
When you insert your data, omit the serial number first.
You can take two different approaches here:
(1) Create a trigger. In the trigger function, calculate your serial number. Take care that two calculations may happen at the same time in different threads. The trigger function then updates your data. Retrieve the inserted serial number with a select query.
(2) Calculate the serial number on the client. Do an update query. When the update fails due to a duplicate value, calculate again with adjusted parameters, and try again, till the update does not fail. Here, I'd use a transaction, and commit when the update was succesful. Looks bad, but with a low chance of duplicates, it will not cause bad performance.
Question1045 - Access denied for user "root@192.168.1.9" using password: YES Pin
Jassim Rahma12-Mar-12 20:12
Jassim Rahma12-Mar-12 20:12 
AnswerRe: 1045 - Access denied for user "root@192.168.1.9" using password: YES Pin
Wayne Gaylard12-Mar-12 20:42
professionalWayne Gaylard12-Mar-12 20:42 
AnswerRe: 1045 - Access denied for user "root@192.168.1.9" using password: YES Pin
Gerben Jongerius12-Mar-12 23:36
Gerben Jongerius12-Mar-12 23:36 

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.