Hello!
I didn't use any DROP statements. Do exactly as following:
mysql CREATE TABLE stats2 LIKE stats;
mysql ALTER TABLE stats2 ADD COLUMN id INT NOT NULL AUTO_INCREMENT,
ADD PRIMARY KEY(id);
mysql INSERT INTO stats2 SELECT *, 0 FROM stats ORDER BY
The first line copies the structure of
Hey friend!
I can't see another way to fix your table without a processing (like a
stored procedure, script, etcetera).
But I believe there is a workaround, which involves a creation of
another table. See this:
mysql CREATE TABLE stats2 LIKE stats;
mysql ALTER TABLE stats2 ADD COLUMN id INT
I am receiving the following error Adriano:
SQL query:
ALTER TABLE `stats` DROP `visits` CREATE TABLE `stats2` LIKE `stats` ;
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
You are missing a semicolon after the first alter statement.
Kapu
On 7. 9. 2010 18:05, Ron Piggott wrote:
I am receiving the following error Adriano:
SQL query:
ALTER TABLE `stats` DROP `visits` CREATE TABLE `stats2` LIKE `stats` ;
MySQL said: Documentation
#1064 - You have an error in
I figured it out, the permissions weren't set on the user to allow the
command to work. Ron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
are you dumping the data or you just want to reset?
issuing the 'empty table' command in phpmyadmin will do that
or you can do
ALTER TABLE tbl AUTO_INCREMENT = 100;
bastien
From: Ron Piggott [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Subject: [PHP-DB]
u can't
- Original Message -
From: Ron Piggott [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Sent: Monday, March 12, 2007 7:52 AM
Subject: [PHP-DB] auto_increment command
I am not sure if that last e-mail went through or not. I am wondering
how to re-set the auto_increment field
Actually you can. As Bastien pointed out:
ALTER TABLE tbl AUTO_INCREMENT = 1;
This may screw with your indexes though, if you have a primary indexed,
or unique indexed row, and you set this to 1, mysql MAY try and
insert conflicting values. I've never done this so I have no idea how
this is
Ron Piggott (PHP) wrote:
How do I change the auto_increment / auto_index value? Ron
Do a query that does what you want.
Without knowing the type of DB you're using (and since this is a PHP
and Database list not just specific DB list) or any other info, there
really isn't much you can
I am using mySQL
On Mon, 2006-05-01 at 13:21 +, replies-lists-
[EMAIL PROTECTED] wrote:
Original Message
Date: Monday, May 01, 2006 09:14:36 AM -0400
From: Ron Piggott (PHP) [EMAIL PROTECTED]
Subject: [PHP-DB] auto_increment
How do I change the
On 5/1/06, Ron Piggott (PHP) [EMAIL PROTECTED] wrote:
I am using mySQL
.. a google search for mysql reset auto_increment reveals the answer!
--
Postgresql php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit:
Ron Piggott (PHP) wrote:
I am using mySQL
In that case, mysql.com woudl have MySQL specific resources since it has
nothgin to do with PHP (aside form that is apparently what you're using
to interact with MySQL)
Please read http://www.catb.org/~esr/faqs/smart-questions.html#forum
the
On Sun, 22 Jan 2006 15:08, Ron Piggott (PHP) wrote:
I have various tables where a column is set to auto_increment in my
table structure. I have been using the following INSERT query format:
INSERT INTO table VALUES ('$auto_increment_variable','$variable_1',
'$variable_2')
and then in
That is the function I was looking for. Thanks. Ron
On Sat, 2006-01-21 at 23:47 -0500, [EMAIL PROTECTED] wrote:
Try:
?php
mysql_query(INSERT INTO table VALUES ('$variable_1', '$variable_2'););
$auto_increment_variable = mysql_insert_id();
?
-TG
= = = Original message =
Thanks Larry.
It was mySQL ...
Ron
On Sun, 26 Dec 2004 20:47:37 -0500, Larry E. Ullman wrote
I have the auto_increment on one of my variables. During the past few
days
I have been doing testing on a live database and created several test
records which I now have deleted from my
I have the auto_increment on one of my variables. During the past few
days
I have been doing testing on a live database and created several test
records which I now have deleted from my table. Is there any way of
setting
the auto_increment value to match the last correct number? Ron
You don't
Thats how its supposed to work. It won't reuse old numbers even after you
delete the entire row.
Adam
On Tue, 27 Aug 2002, simon wrote:
Hi
Wondering if anybody can help with this:
My table has an INT column named 'member_id' which is set to AUTO_INCREMENT.
It
Hi simon
My table has an INT column named 'member_id' which is set to
AUTO_INCREMENT.
It works very well but I have inserted and deleted some test rows during
the
development stage and now my incremented numbers have jumped ahead.
The deleted rows (their member_id values) have not been
Checl your MySQL docs and redefine the table if necessary:
table type of ISAM - autoincrement numbers get reused
table type of MyISAM - autoincrement numbers are not reused.
Many people prefer the latter and use the values as primary and foreign keys.
Miles Thompson
At 05:21 PM 8/27/2002
: Ross Gerring
Subject: Re: [PHP-DB] auto_increment problem???
Russ,
Check your docs to confirm this, as you are probably running a later
version than I'm familiar with. If the table is defined as type MyISAM
the autoincrement numbers do not get reused, they steadily increase. You
can rely on them
)??
Thanks a lot for your help. :-)
-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]]
Sent: Saturday, August 24, 2002 12:12 AM
To: Russ; [EMAIL PROTECTED]
Cc: Ross Gerring
Subject: Re: [PHP-DB] auto_increment problem???
Russ,
Check your docs to confirm this, as you
- Original Message -
From: Bas Jobsen [EMAIL PROTECTED]
To: Sheridan Saint-Michel [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, October 05, 2001 9:50 AM
Subject: Re: [PHP-DB] Howto make a double LEFT JOIN
snip
ACK! Don't do this. You do know that an unsigned int (using a signed
The correct question is if it's even possible to use a non integer field
with auto_increment with MySQL (assuming it's MySQL)
and the answer is : No. you must use an int type.
From the MySQL manual : "An integer column may have the additional attribute
AUTO_INCREMENT. ".
Sincerely
berber
You can use the Serial Datatype if using Postgres.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
Hi,
well usually yuto_increment is used on ID fields.
then depending on how many rows your table has
tinyint (up to 255; 1k), smallint (up to 65535; 2k)
mediumint (up to 16777215; 3k) int (up to 4294967295, 4k).
Johannes
"Ben Cairns" [EMAIL PROTECTED] schrieb im Newsbeitrag
I may be semi-new to this MySQl lark but I'm sure auto_increment starts
at 0.
Russ
#---#
"Believe nothing - consider everything"
Russ
The version you use may be lower than 3.23 because auto_increment sequence
number begin at 1 for MySQL version up to 3.23.
"Russ Michell" [EMAIL PROTECTED] ?
news:[EMAIL PROTECTED]...
I may be semi-new to this MySQl lark but I'm sure auto_increment starts
at 0.
Russ
At 12:58 PM 3/4/01 +0100, Joris Kluivers wrote:
hi,
i have a problem
i have a database table created with the statement:
CREATE TABLE chatmessages (id tinyint(6) DEFAULT '0' NOT NULL
AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id);
I insert records with:
INSERT INTO
28 matches
Mail list logo