开发者

what does select @@identity do?

i am connecting to a mysql database through excel using odbc

what does this line do?

Set rs = oConn.Execute("SELECT @@identity", , adCmdText)

i am having trouble updating the database:

   With rs
        .AddNew ' create a new record
        ' add values to each field in the record
        .Fields("datapath") = dpath
        .Fields("analysistime") = atime
        .Fields("reporttime") = rtime
        .Fie开发者_运维百科lds("lastcalib") = lcalib
        .Fields("analystname") = aname
        .Fields("reportname") = rname
        .Fields("batchstate") = "bstate"
        .Fields("instrument") = "NA"
        .Update ' stores the new record
    End With

it is ONLY updating .Fields("instrument") = "NA", but for all other fields it is putting NULL values


It selects (and returns) the last value inserted into an IDENTITY COLUMN in the current connection.

Here is reference material on the topic

http://dev.mysql.com/doc/refman/5.0/en/getting-unique-id.html


It retrieves the identity of the last record you inserted into the database. See here: http://www.kamath.com/tutorials/tut007_identity.asp


It retrieves the last inserted identity from an AUTO_INCREMENT column. However, I thought that LAST_INSERT_ID() was the proper function to use in MYSQL. I've never seen any reference to @@IDENTITY in the documentation. I thought it was only a SQL Server/Sybase construct.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜