Bluehost.com Web Hosting $6.95

@@identity when inserting multiple values

This is a discussion on @@identity when inserting multiple values within the MySQL Database forums, part of the Database Forums category; Dear group, I am writing C# Linq driver for MySql (project page at http://code2code.net/Linq_Mysql/ ) I would like ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-13-2007
gmoudry@gmail.com
 
Posts: n/a
Default @@identity when inserting multiple values

Dear group,
I am writing C# Linq driver for MySql (project page at http://code2code.net/Linq_Mysql/
)

I would like to use multiple-value-inserts for speed, e.g.:
INSERT INTO table1 (column1) VALUES (1), (2), (3); SELECT @@IDENTITY

Since @@IDENTITY returns only the identity of the last row, how would
you retrieve the identities of the previous rows? Can I think of
multiple-value-inserts as atomic, and deduce previous IDs?

Thanks,
George

Reply With Quote
  #2 (permalink)  
Old 03-14-2007
Willem Bogaerts
 
Posts: n/a
Default Re: @@identity when inserting multiple values

<snip>
> INSERT INTO table1 (column1) VALUES (1), (2), (3); SELECT @@IDENTITY
> Since @@IDENTITY returns only the identity of the last row,...


This is MS SQL Server code. In MySQL, the function is called
LAST_INSERT_ID() and it returns the first generated ID. Look at the
documentation on the MySQL site for more details.

Best regards
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:42 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0