I would like to change one of my tables so that future inserts use a
higher range of numbers for the primary key values.
I have a table 'event' with column:
id int unsigned not null auto_increment primary key
Currently new records are going into the table with id column values
in the
,
melanie
From: Dan Buettner [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Subject: Changing range of identity column for future inserts
Date: Tue, 15 Nov 2005 08:50:03 -0600
I would like to change one of my tables so that future inserts use a higher
range of numbers for the primary key values.
I
mel list_php wrote:
From: Dan Buettner [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Subject: Changing range of identity column for future inserts
Date: Tue, 15 Nov 2005 08:50:03 -0600
I would like to change one of my tables so that future inserts use a
higher range of numbers for the primary
@lists.mysql.com
Subject: Changing range of identity column for future inserts
Date: Tue, 15 Nov 2005 08:50:03 -0600
I would like to change one of my tables so that future inserts use
a higher range of numbers for the primary key values.
I have a table 'event' with column:
id int unsigned not null
I am migrating from MS SQL Server to MySQL 4.1.
I have code in my ColdFusion/SQL Server application that went something
like this:
cfquery name=insertquery
SET NOCOUNT ON
INSERT INTO TABLE ()
SELECT @@IDENTITY AS adid
SET NOCOUNT OFF
/cfquery
That whole block was processed in coldfusion
On 9/7/2005 1:17 PM Ryan Stille intelligently wrote:
I am migrating from MS SQL Server to MySQL 4.1.
I have code in my ColdFusion/SQL Server application that went something
like this:
cfquery name=insertquery
SET NOCOUNT ON
INSERT INTO TABLE ()
SELECT @@IDENTITY AS adid
SET NOCOUNT
it might be best to ask this in the cf forums, however did
you try to separate the statements with a ; ? I haven't tried
2 query statements for MySQL in cfquery...yet ;-) Also I
believe MySQL 3.23+ supports @@identity
Yes I've tried semicolons after the statements, and I've tried setting
that went something
like this:
cfquery name=insertquery
SET NOCOUNT ON
INSERT INTO TABLE ()
SELECT @@IDENTITY AS adid
SET NOCOUNT OFF
/cfquery
That whole block was processed in coldfusion as a single query. I gave
it a name of insertquery, and I can get the ID back as
insertquery.adid.
I am
Hi All
Whats the preferred syntax to insert values in multiple (related) tables
I insert one record, then i need the ID of the inserted value to add it
the with the other inserts
with MSSQL stored procs its
INSERT INTO .
SELECT @MyID = @@IDENTITY
after
INTO .
SELECT @MyID = @@IDENTITY
after that you can use @MyID
So whats the preferred method with MySQL, is there a easy way to get the
Identity back from a just inserted record, or do i just have to do a
select based on a value i did just insert ?
Use AUTO_INCREMENT column
How can I select the last record that was inserted? An ASP/VB example would
be great too!
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Aaron wrote:
How can I select the last record that was inserted? An ASP/VB example would
be great too!
I believe you have it already.
I use:
select last_insert_id() as MyID
but from memory @@identity is a synonym of last_insert_id()
Dan
--
sig
Daniel Kasak
IT Developer
NUS
: Aaron [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 10, 2004 7:04 PM
Subject: @@identity
How can I select the last record that was inserted? An ASP/VB example
would
be great too!
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe
Rough example. Assuming that you are using the same connection since
last_insert_id() is connection specific.
rset.open INSERT INTO table1 values(someValue)
rset.open SELECT last_insert_id() as identity
identity = rset.fields(identity)
-Original Message-
From: Aaron
To: [EMAIL
Great - thanks!
-Original Message-
From: Victor Pendleton [mailto:[EMAIL PROTECTED]
Sent: March 10, 2004 5:36 PM
To: 'Aaron '; '[EMAIL PROTECTED] '
Subject: RE: @@identity
Rough example. Assuming that you are using the same connection since
last_insert_id() is connection specific
Hi, I am a beginner in using database. And I
appreciate your support and help.
When we first create a table,
1. is it possible to create a column that identifies
each record that is to be inserted?
2. If we can create this IDENTITY column, how do we
create it? Do we set a maximum
database. And I
appreciate your support and help.
When we first create a table,
1. is it possible to create a column that identifies
each record that is to be inserted?
2. If we can create this IDENTITY column, how do we
create it? Do we set a maximum to the value of this
column? Or the value
I'm using php + mysql for my project
I want to get the last insert ID.
I could use the php function mysql_last_id();
but I could aslo use @@identity.
Now some people have advised me NOT to use @@identity, cause it's not
save buggy sometimes slow ..
is this true am I better of with the php
: Wednesday, June 18, 2003 1:37 PM
To: 'Mysql'
Subject: @@identity
I'm using php + mysql for my project
I want to get the last insert ID.
I could use the php function mysql_last_id();
but I could aslo use @@identity.
Now some people have advised me NOT to use @@identity, cause it's not
save buggy
: Wednesday, June 18, 2003 12:59 PM
To: 'Jonas Geiregat'; 'Mysql'
Subject: RE: @@identity
This may not be the correct solution exactly, but what I do to ensure that I
get the correct ID back is the following:
I know what I just inserted, therefore I can use this information in a WHERE
clause to ensure
On Wednesday 18 June 2003 13:59, Carter, Scott wrote:
This may not be the correct solution exactly, but what I do to ensure that
I get the correct ID back is the following:
I know what I just inserted, therefore I can use this information in a
WHERE clause to ensure retrieving the correct ID.
One should always use the
LAST_INSERT_ID() or after an insert, select max(id) from myTable.
Select max(id) from myTable should never be used to get the last insert id.
On a high traffic table you are not guaranteed it will be the ID for the
record you just inserted, another could have been
On 18-Jun-2003 Jonas Geiregat wrote:
I'm using php + mysql for my project
I want to get the last insert ID.
I could use the php function mysql_last_id();
but I could aslo use @@identity.
Now some people have advised me NOT to use @@identity, cause it's not
save buggy sometimes slow
Don Read wrote:
On 18-Jun-2003 Jonas Geiregat wrote:
I'm using php + mysql for my project
I want to get the last insert ID.
I could use the php function mysql_last_id();
but I could aslo use @@identity.
Now some people have advised me NOT to use @@identity, cause it's not
save buggy sometimes
Hi
I m using mysql 3.23.51 on win 2k
Well..I have a user table where i have the userid column as primary key and
auto_increment column and name as varchar(25).
I insert values in the table such as
Insert into user (name) values ('AA');
Then When i do select @@Identity in the next time
Even the last_insert_id() returns 0
is it coz the table type is INNODB
- Original Message -
From: Jan Peuker [EMAIL PROTECTED]
To: Arul [EMAIL PROTECTED]
Sent: Friday, June 21, 2002 4:16 PM
Subject: Re: @@IDENTITY
You are using M$-Syntax, in MySQL you should use:
SELECT
Subject: Re: @@IDENTITY
You are using M$-Syntax, in MySQL you should use:
SELECT last_insert_id()
http://www.mysql.com/doc/e/x/example-AUTO_INCREMENT.html
regards,
jan
- Original Message -
From: Arul
To: MySQL
Sent: Friday, June 21, 2002 12:17 PM
Subject
I don't know if this is just weirdness on my system but I thought I would
pass this on in case anyone runs into this problem. I'm converting some
Java/JDBC code from a commercial DBMS to MySQL. The existing code executed
the SQL statement Select @@identity after an INSERT to retrieve
-Original Message-
From: Richard Davidson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 29, 2002 1:31 PM
To: MySql List; [EMAIL PROTECTED]
Subject: FYI: @@IDENTITY
I don't know if this is just weirdness on my system but I
thought I would
pass this on in case anyone runs
29 matches
Mail list logo