auto_increment Issue

2009-04-10 Thread Jnaneshwar Bantanur

Hi All

I have created a  table.Now I need to make a field Auto_increment...Help
me with this issue..An example will do..

Regards
Jnani


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org

RE: auto_increment Issue

2009-04-10 Thread abdulazeez alugo


 

 Date: Fri, 10 Apr 2009 15:15:28 +0530
 From: jnaneshwar.banta...@kavach.net
 To: mysql@lists.mysql.com
 Subject: auto_increment Issue
 
 
 Hi All
 
 I have created a table.Now I need to make a field Auto_increment...Help
 me with this issue..An example will do..
 
 Regards
 Jnani


Hi Jnani,

Assuming your table name is tbl  and the field for the auto_increment is id, 
just write:

 

ALTER TABLE tbl CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT;

 

I hope that helps.

Cheers.

 

Alugo Abdulazeez.


_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx

Re: auto_increment Issue

2009-04-10 Thread Jnaneshwar Bantanur
Hi

While trying for the same,I am getting the following error

Incorrect table definition; there can be only one auto column and it
must be defined as a key

Jnani

Octavian Rasnita wrote:
 Or more simple:
 
 ALTER TABLE tbl modify id INT UNSIGNED NOT NULL AUTO_INCREMENT;
 
 -- 
 Octavian
 
 - Original Message - From: abdulazeez alugo
 defati...@hotmail.com
 To: jnaneshwar.banta...@kavach.net; mysql@lists.mysql.com
 Sent: Friday, April 10, 2009 1:07 PM
 Subject: RE: auto_increment Issue
 
 
 
 
 
 
 Date: Fri, 10 Apr 2009 15:15:28 +0530
 From: jnaneshwar.banta...@kavach.net
 To: mysql@lists.mysql.com
 Subject: auto_increment Issue


 Hi All

 I have created a table.Now I need to make a field Auto_increment...Help
 me with this issue..An example will do..

 Regards
 Jnani
 
 
 Hi Jnani,
 
 Assuming your table name is tbl  and the field for the auto_increment is
 id, just write:
 
 
 
 ALTER TABLE tbl CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT;
 
 
 
 I hope that helps.
 
 Cheers.
 
 
 
 Alugo Abdulazeez.
 
 
 _
 Show them the way! Add maps and directions to your party invites.
 http://www.microsoft.com/windows/windowslive/products/events.aspx


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org

RE: auto_increment Issue

2009-04-10 Thread abdulazeez alugo


 

 Date: Fri, 10 Apr 2009 15:55:33 +0530
 From: jnaneshwar.banta...@kavach.net
 To: orasn...@gmail.com
 CC: defati...@hotmail.com; mysql@lists.mysql.com
 Subject: Re: auto_increment Issue
 
 Hi
 
 While trying for the same,I am getting the following error
 
 Incorrect table definition; there can be only one auto column and it
 must be defined as a key
 
 Jnani
 
  
  Hi Jnani,
  
  Assuming your table name is tbl and the field for the auto_increment is
  id, just write:
  
  
  
  ALTER TABLE tbl CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT;
  
  
  
  I hope that helps.
  
  Cheers.
  
  
  
  Alugo Abdulazeez.
  
Oh sorry!

it should be ALTER TABLE tbl CHANGE id id INT UNSIGNED NOT NULL PRIMARY KEY 
AUTO_INCREMENT;

I hope this helps unless you have a column already defined as auto_increment in 
the same table.

Cheers.

_
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx

Re: auto_increment Issue

2009-04-10 Thread Jnaneshwar Bantanur
Hi ,

Thanks,Its working now

Jnani

abdulazeez alugo wrote:
 
  
 
 Date: Fri, 10 Apr 2009 15:55:33 +0530
 From: jnaneshwar.banta...@kavach.net
 To: orasn...@gmail.com
 CC: defati...@hotmail.com; mysql@lists.mysql.com
 Subject: Re: auto_increment Issue

 Hi

 While trying for the same,I am getting the following error

 Incorrect table definition; there can be only one auto column and it
 must be defined as a key

 Jnani

 Hi Jnani,

 Assuming your table name is tbl and the field for the auto_increment is
 id, just write:



 ALTER TABLE tbl CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT;



 I hope that helps.

 Cheers.



 Alugo Abdulazeez.

 Oh sorry!
 
 it should be ALTER TABLE tbl CHANGE id id INT UNSIGNED NOT NULL PRIMARY KEY 
 AUTO_INCREMENT;
 
 I hope this helps unless you have a column already defined as auto_increment 
 in the same table.
 
 Cheers.
 
 _
 News, entertainment and everything you care about at Live.com. Get it now!
 http://www.live.com/getstarted.aspx


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org