List:General Discussion« Previous MessageNext Message »
From:Greg Matthews Date:December 28 2002 4:18am
Subject:Re: scanning for auto increment columns
View as plain text  
ok, just answering my own question here.

found it.

"describe <tablename>" contains "auto_increment" in the "extra" column,
which gives me what I want.

sql,query

----- Original Message -----
From: "Greg Matthews" <greg55@stripped>
To: <mysql@stripped>
Sent: Saturday, December 28, 2002 8:34 AM
Subject: scanning for auto increment columns


> All,
>
> I'd like to be able to query MySql using the JDBC driver to determine
which
> tables have auto incremented columns.
>
> In MSSQL I can retrieve data from the syscolumns and sysobjects tables to
> find out which columns are IDENTITY columns, but have had no luck trying
to
> do something similar in MySql (4.05).
>
> e.g.
>
> select so.name, sc.name from syscolumns sc, sysobjects so where sc.autoval
> is not null and so.xtype = 'U' and so.id = sc.id order by 1,2
>
>
> I'm extending some J2EE app generator functionality, and so would like to
be
> able to scan a database without knowing beforehand (based on business
> knowledge) which tables have auto incremented columns.
>
> I've tried:
>
> 1. Going over the java.sql metadata functionality to see if I can query
this
> through the standard java.sql functions.
>
> 2. Searching the MySql manual
>
> Any help much appreciated.
>
> Greg.
>
>
> sql, query
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <mysql-thread128505@stripped>
> To unsubscribe, e-mail
<mysql-unsubscribe-greg55=ozemail.com.au@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>

Thread
scanning for auto increment columnsGreg Matthews27 Dec
  • Re: scanning for auto increment columnsMark Matthews27 Dec
  • Re: scanning for auto increment columnsGreg Matthews28 Dec