RE: trying to copy the autonumber from one table to the next
From: Brian Brown (BrianBrown_at_discussions.microsoft.com)
Date: 12/06/04
- Next message: MattC: "How to factorise this code"
- Previous message: Sami Vaaraniemi: "Re: xmlserializer and sockets"
- In reply to: sparks_at_somewhere.net: "trying to copy the autonumber from one table to the next"
- Next in thread: Peter Row: "Re: trying to copy the autonumber from one table to the next"
- Reply: Peter Row: "Re: trying to copy the autonumber from one table to the next"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 6 Dec 2004 06:19:07 -0800
Sparks,
You cannot call just SELECT @@IDENTITY. Sql has no way of knowing what
record you want to look for. Would it be possible for you to write a stored
proc and send it your parameters? Then you could use a return statement in
the stored proc to return the ID of the inserted record and then grab it
using ExecuteScalar(). This is a lot more efficient and reliable all the way
around.
Good Luck!
- Next message: MattC: "How to factorise this code"
- Previous message: Sami Vaaraniemi: "Re: xmlserializer and sockets"
- In reply to: sparks_at_somewhere.net: "trying to copy the autonumber from one table to the next"
- Next in thread: Peter Row: "Re: trying to copy the autonumber from one table to the next"
- Reply: Peter Row: "Re: trying to copy the autonumber from one table to the next"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|