Click here to Skip to main content
15,923,083 members
Home / Discussions / Database
   

Database

 
AnswerRe: Multiple Result sets ADO.NET?? Pin
Heath Stewart1-Dec-03 8:25
protectorHeath Stewart1-Dec-03 8:25 
GeneralRe: Multiple Result sets ADO.NET?? Pin
Rocky Moore1-Dec-03 9:35
Rocky Moore1-Dec-03 9:35 
GeneralRe: Multiple Result sets ADO.NET?? Pin
Heath Stewart1-Dec-03 10:32
protectorHeath Stewart1-Dec-03 10:32 
GeneralRe: Multiple Result sets ADO.NET?? Pin
Rocky Moore1-Dec-03 21:18
Rocky Moore1-Dec-03 21:18 
GeneralRe: Multiple Result sets ADO.NET?? Pin
Heath Stewart2-Dec-03 2:57
protectorHeath Stewart2-Dec-03 2:57 
GeneralRe: Multiple Result sets ADO.NET?? Pin
Rocky Moore1-Dec-03 23:08
Rocky Moore1-Dec-03 23:08 
General2 tables and a stored procedure Pin
toticow1-Dec-03 2:14
susstoticow1-Dec-03 2:14 
GeneralRe: 2 tables and a stored procedure Pin
Mike Dimmick1-Dec-03 3:17
Mike Dimmick1-Dec-03 3:17 
I'm assuming SQL Server 2000, and that you have no usable key data (for example, it's possible for every field in two different records to be identical, apart from a key field).

If you're generating your own primary keys, there shouldn't be an issue. What you'd normally do is keep some form of incrementing identifier in a separate table. You'd read the next value into a variable, update the stored value, then use that key information in both places.

If you're using automatic numbering (using an IDENTITY column), you can retrieve the last inserted identifier using the SCOPE_IDENTITY() function. You need to retrieve this straight after the first INSERT, otherwise it may not be the correct identifier.

Depending on your requirements, you may want to put both INSERTs inside a transaction. Do this if you want to be sure that either both, or neither, INSERT completes. Be aware that if an error occurs, the transaction is not automatically rolled back. See SQL Server Transactions and Error Handling[^] in the Articles section.
GeneralMonitor bandwidth usage Pin
Paul Watson1-Dec-03 0:52
sitebuilderPaul Watson1-Dec-03 0:52 
GeneralRe: Monitor bandwidth usage Pin
Rocky Moore1-Dec-03 6:24
Rocky Moore1-Dec-03 6:24 
GeneralPreparing SQL for Insert Pin
FruitBatInShades30-Nov-03 23:34
FruitBatInShades30-Nov-03 23:34 
GeneralRe: Preparing SQL for Insert Pin
Mike Dimmick1-Dec-03 3:43
Mike Dimmick1-Dec-03 3:43 
GeneralRe: Preparing SQL for Insert Pin
Sean McCormack3-Dec-03 3:01
Sean McCormack3-Dec-03 3:01 
Generalrows in nested relationship couldnt be deleted Pin
meroo30-Nov-03 18:47
meroo30-Nov-03 18:47 
GeneralSql query question Pin
pankajdaga30-Nov-03 3:26
pankajdaga30-Nov-03 3:26 
GeneralRe: Sql query question Pin
Ian Darling30-Nov-03 3:50
Ian Darling30-Nov-03 3:50 
Generalserver explorer Pin
Member 72360328-Nov-03 23:48
Member 72360328-Nov-03 23:48 
GeneralRe: server explorer Pin
Mike Dimmick1-Dec-03 6:44
Mike Dimmick1-Dec-03 6:44 
Generali want to del a row from nested relationship Pin
meroo28-Nov-03 6:35
meroo28-Nov-03 6:35 
GeneralRe: i want to del a row from nested relationship Pin
Husein29-Nov-03 9:41
Husein29-Nov-03 9:41 
Generali want to del a row from data grid Pin
kings_128-Nov-03 6:04
kings_128-Nov-03 6:04 
QuestionHow to retrieve image data with MSDE Pin
parag28-Nov-03 1:20
parag28-Nov-03 1:20 
Generalstoring passwords ! Pin
ranjjj27-Nov-03 18:45
ranjjj27-Nov-03 18:45 
GeneralRe: storing passwords ! Pin
Vasudevan Deepak Kumar27-Nov-03 20:40
Vasudevan Deepak Kumar27-Nov-03 20:40 
GeneralRe: storing passwords ! Pin
Steve S8-Dec-03 0:28
Steve S8-Dec-03 0:28 

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.