problems width select line

Discussion in 'ASP General' started by Christopher Brandsdal, Jul 21, 2003.

  1. 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;
    }
    Christopher Brandsdal, Jul 21, 2003
    #1
    1. Advertising

  2. Christopher Brandsdal

    Ray at Guest

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

    Ray at work

    "Christopher Brandsdal" <> wrote in AN HTML message
    news:%...
    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;
    }
    Ray at, Jul 21, 2003
    #2
    1. Advertising

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

    Best thank's from Norway!;)
    Christopher Brandsdal


    "Aaron Bertrand - MVP" <> skrev i melding
    news:uRQQ#...
    > @@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" <> wrote in message
    > news:#...
    > 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;
    > }
    >
    >
    Christopher Brandsdal, Jul 21, 2003
    #3
  4. Christopher Brandsdal

    Ray at Guest

    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" <> wrote in message
    news:...
    > You guy's are amazing!!!
    > Is there anything you DON'T know?
    >
    > Best thank's from Norway!;)
    > Christopher Brandsdal
    >
    >
    > "Aaron Bertrand - MVP" <> skrev i melding
    > news:uRQQ#...
    > > @@IDENTITY is a SQL Server variable representing the last inserted

    > IDENTITY
    > > value for this
    Ray at, Jul 21, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AndrewF
    Replies:
    1
    Views:
    765
    Bruce Barker
    Oct 10, 2005
  2. Hugo
    Replies:
    10
    Views:
    1,303
    Matt Humphrey
    Oct 18, 2004
  3. kaushikshome
    Replies:
    4
    Views:
    761
    kaushikshome
    Sep 10, 2006
  4. palmiere
    Replies:
    1
    Views:
    396
    Erwin Moller
    Feb 9, 2004
  5. SamuelXiao
    Replies:
    5
    Views:
    276
    Thomas 'PointedEars' Lahn
    Jan 6, 2010
Loading...

Share This Page