This is a multi-part message in MIME format.

------=_NextPart_000_003C_01C34FC1.EE9CC600
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi!

I am having some problems width a little script i downloaded...

I'm not able to figure out what he SELECT line does!
What does the @@identity mean?
Is this maby a javascript? :)



function GetLastIdentity(ADOConnection)
{
var rstIdentity =3D Server.CreateObject("ADODB.Recordset");
rstIdentity.Open("SELECT @@identity AS IdentityId", ADOConnection);
var iIdentity =3D rstIdentity.EOF =3D=3D false ? =
rstIdentity("IdentityId").value : -1;
rstIdentity.Close();
return iIdentity;
}

------=_NextPart_000_003C_01C34FC1.EE9CC600
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am having some problems width a =
little script i=20
downloaded...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm not able to figure out what he =
SELECT line=20
does!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>What does the @@identity =
mean?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is this maby a javascript? =
:)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>function=20
GetLastIdentity(ADOConnection)<BR>{<BR>&nbsp;var rstIdentity =3D=20
Server.CreateObject("ADODB.Recordset");<BR><STRONG>&nbsp;<FONT=20
color=3D#ff0000>rstIdentity.Open("SELECT @@identity AS IdentityId",=20
ADOConnection);</FONT></STRONG><BR>&nbsp;var iIdentity =3D =
rstIdentity.EOF =3D=3D=20
false ? rstIdentity("IdentityId").value :=20
-1;<BR>&nbsp;rstIdentity.Close();<BR>&nbsp;return=20
iIdentity;<BR>}</FONT></DIV></BODY></HTML>

------=_NextPart_000_003C_01C34FC1.EE9CC600--

Re: problems width select line by Ray

Ray
Mon Jul 21 13:01:58 CDT 2003

An explanation of what @@IDENTITY is can be found here.
http://www.aspfaq.com/show.asp?id=2174

Ray at work

"Christopher Brandsdal" <christopherwb@c2i.net> wrote in AN HTML message
news:%23iSrsE7TDHA.3188@tk2msftngp13.phx.gbl...
Hi!

I am having some problems width a little script i downloaded...

I'm not able to figure out what he SELECT line does!
What does the @@identity mean?
Is this maby a javascript? :)



function GetLastIdentity(ADOConnection)
{
var rstIdentity = Server.CreateObject("ADODB.Recordset");
rstIdentity.Open("SELECT @@identity AS IdentityId", ADOConnection);
var iIdentity = rstIdentity.EOF == false ? rstIdentity("IdentityId").value
: -1;
rstIdentity.Close();
return iIdentity;
}



Re: problems width select line by Christopher

Christopher
Mon Jul 21 13:23:44 CDT 2003

You guy's are amazing!!!
Is there anything you DON'T know?

Best thank's from Norway!;)
Christopher Brandsdal


"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> skrev i melding
news:uRQQ#I7TDHA.2128@TK2MSFTNGP12.phx.gbl...
> @@IDENTITY is a SQL Server variable representing the last inserted
IDENTITY
> value for this connection's session (that's a SQL Server session, not an
ASP
> session).
>
> In this case, the GetLastIdentity() function would be of very little use
> unless it is called directly after a barebones INSERT statement.
>
> If you're using SQL Server 2000, SCOPE_IDENTITY() is safer than
@@IDENTITY,
> since the latter is vulnerable to chained inserts (e.g. a trigger on the
> object table that, in turn, inserts into another table with an IDENTITY
> column).
>
> http://www.aspfaq.com/2174
>
>
>
>
> "Christopher Brandsdal" <christopherwb@c2i.net> wrote in message
> news:#iSrsE7TDHA.3188@tk2msftngp13.phx.gbl...
> Hi!
>
> I am having some problems width a little script i downloaded...
>
> I'm not able to figure out what he SELECT line does!
> What does the @@identity mean?
> Is this maby a javascript? :)
>
>
>
> function GetLastIdentity(ADOConnection)
> {
> var rstIdentity = Server.CreateObject("ADODB.Recordset");
> rstIdentity.Open("SELECT @@identity AS IdentityId", ADOConnection);
> var iIdentity = rstIdentity.EOF == false ?
rstIdentity("IdentityId").value
> : -1;
> rstIdentity.Close();
> return iIdentity;
> }
>
>



Re: problems width select line by Ray

Ray
Mon Jul 21 13:30:36 CDT 2003

There are lots of things I don't know. There is only one thing that Aaron
doesn't know though - euphemismic conversation. :P

Ray at work

"Christopher Brandsdal" <christopherwb@c2i.net> wrote in message
news:OvTe5U7TDHA.2308@TK2MSFTNGP12.phx.gbl...
> You guy's are amazing!!!
> Is there anything you DON'T know?
>
> Best thank's from Norway!;)
> Christopher Brandsdal
>
>
> "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> skrev i melding
> news:uRQQ#I7TDHA.2128@TK2MSFTNGP12.phx.gbl...
> > @@IDENTITY is a SQL Server variable representing the last inserted
> IDENTITY
> > value for this