By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,246 Members | 2,126 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,246 IT Pros & Developers. It's quick & easy.

problems width select line

P: n/a
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;
}

Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


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

Ray at work

"Christopher Brandsdal" <ch***********@c2i.net> wrote in AN HTML message
news:%2****************@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;
}
Jul 19 '05 #2

P: n/a
You guy's are amazing!!!
Is there anything you DON'T know?

Best thank's from Norway!;)
Christopher Brandsdal
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> skrev i melding
news:uR**************@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" <ch***********@c2i.net> wrote in message
news:#i**************@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;
}

Jul 19 '05 #3

P: n/a
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" <ch***********@c2i.net> wrote in message
news:Ov**************@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" <aa***@TRASHaspfaq.com> skrev i melding
news:uR**************@TK2MSFTNGP12.phx.gbl...
@@IDENTITY is a SQL Server variable representing the last inserted

IDENTITY
value for this

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.