Showing posts with label MySql. Show all posts
Showing posts with label MySql. Show all posts

Wednesday, March 14, 2012

How to get next AUTO_INCREMENT value in mysql

there are two possibilities to access next auto_increment variable associated with a particular table in MySql

1) Using information schema

select auto_increment
from information_schema.tables
where table_schema = 'db_name'
 and table_name = 'table_name'

2) accessing status of database

SHOW TABLE STATUS  where name="table_name"

1st give only next auto increment value but second gives some additional information other than that.

hope this helps....cheers......

Tuesday, July 21, 2009

Mysql Search and Replace

Use this query to search and replace in mysql.

update 'tablename' set field = replace(field,'search_item','replace_item');

LinkWithin

Related Posts with Thumbnails