Re: Getting the value that was generated using the IDENTITY property

From: Aaron Bertrand - MVP (aaron_at_TRASHaspfaq.com)
Date: 05/04/04


Date: Tue, 4 May 2004 11:28:23 -0400


???

-- 
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
<y_tyagi79@yahoo.com> wrote in message
news:upSr9qeMEHA.2704@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> Yes Anith is very much correct but remember to use left(Date_Col, 12) =
> @DateVal in where clause of queries in stored procedure.
>
> Best Regards
> Yogesh
>
> "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
> news:uo4RKpeMEHA.3348@TK2MSFTNGP09.phx.gbl...
> > > You can use @@IDENTITY system variable which variable which will be
> > > populated with the last identity value always.
> >
> > Actually, the reason I suggested SCOPE_IDENTITY as opposed to @@IDENTITY
> is
> > that @@IDENTITY can be tampered with between the INSERT and the
retrieval
> of
> > the value, e.g. if the table has a trigger that in turn causes a
separate
> > @@IDENTITY to be generated.  SCOPE_IDENTITY() is immune to this side
> effect.
> >
> > A
> >
> >
>
>


Relevant Pages

  • Re: Invalid Cursor State
    ... Did they give you a reason? ... Aaron Bertrand ... SQL Server MVP ... "Gary Abbott" wrote in message ...
    (microsoft.public.sqlserver.server)
  • Re: Export to Excel or txt File
    ... Any particular reason why you performed a WHOIS on aspfaq.com, ... Aaron Bertrand ... SQL Server MVP ...
    (microsoft.public.inetserver.asp.general)
  • Re: sql functions
    ... in 7.0 mode for a reason. ... Aaron Bertrand ... SQL Server MVP ... > to SQL Server Books Online for more details on its usage. ...
    (microsoft.public.sqlserver.programming)
  • Re: DB Compatibility Level
    ... > 1) What might be a reason for setting a lower compatibility level? ... Aaron Bertrand ... SQL Server MVP ...
    (microsoft.public.sqlserver.server)
  • Re: Find the first available integer.
    ... by being in simple recovery model). ... using a real server with a real disk system, and if you insert a reasonable ... Aaron Bertrand ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)

Loading