Re: Copy identity key in new record in related table.
From: Wm. Scott Miller (Scott.Miller_at_spamkillerwvinsurance.gov)
Date: 01/04/05
- Next message: Joseph Scalise: "display row(s) affected"
- Previous message: Bob Barrows [MVP]: "Re: Offsetting again"
- In reply to: Nico Heiligers: "Re: Copy identity key in new record in related table."
- Next in thread: Aaron [SQL Server MVP]: "Re: Copy identity key in new record in related table."
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 4 Jan 2005 14:56:45 -0500
Nico:
If you read the BOL on @@IDENTITY you will see it is prone to problems if
something else (like a trigger) inserts another record after you insert one.
You need to use it with the thought in the back of your mind that it might
not work as expected or may lead to a problem in the future if your business
rules change and you need to add objects to your database.
Scott
"Nico Heiligers" <nheiligers@chello.nl> wrote in message
news:%23Fg2fPp8EHA.3028@TK2MSFTNGP10.phx.gbl...
>
> Thanks to you both
> I have tried @@IDENTITY and it worked just fine.
> I will read about the the other two options, in the BOL
>
> Ps what do you mean with
> @@IDENTITY can give you unexpected result?
>
> Regards
> Nico
>
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
- Next message: Joseph Scalise: "display row(s) affected"
- Previous message: Bob Barrows [MVP]: "Re: Offsetting again"
- In reply to: Nico Heiligers: "Re: Copy identity key in new record in related table."
- Next in thread: Aaron [SQL Server MVP]: "Re: Copy identity key in new record in related table."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|