Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Posts
    11

    Red face Unanswered: Access And Mysql Autonumber Rows

    FOR SQL EXIST THE FOLOWING POSIBILITY TO AUTONUMBER A QUERYS RESULT ROWS

    SET @ NRROW=START_NR;
    SELECT @NRROW:=NRROW+1 AS RowNumber, ETC FIELDS FROM TABLE;

    THE RESULT WILL INCLUDE A COLUMN WITH THE AUTONUMBER FOR THE QUERY BY START_NR UP.

    IS ANY WAY TO DO THE SAME THING FROM A ACCESS PASS THROUGH QUERY ?
    IF I IMPLEMENT THIS COD ABOVE I GOT AN ERROR FROM ODBC ABOUT THE ";" SEPARATOR

    ALL I WANT IS A EASY WAY TO NUMBER A QUERY RESULT AND BELIVE ME THE SQL WAY IS VERRRY EASSSSY ...
    I PUT THE QUESTION TO THE MYSQL SECTION AND THEY SENT ME HERE .

    ANY HINT PLEASE ??

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Sorry but i thing that with query in Access is not possible ( i never can do it...), but you can create a temporal table with and autonumeric field and take the data from that table, after run the query remove the table for the next time.
    Saludos
    Norberto

  3. #3
    Join Date
    Feb 2002
    Location
    Sydney
    Posts
    21
    A fellow MySQL user! Cool.

    Yes you can use a pass-through query in Access to do this.

    Create the pass-through query, and set it's ODBC connection string. The connection string MUST include a pointer to the database you wish to use. Currently, MySQL doesn't support multiple statements separated by semicolons, but will very soon...

    For the query's SQL, enter something like:

    Code:
    CREATE TABLE `Installations` (
      `ID` mediumint(8) unsigned NOT NULL auto_increment,
      `MyStamp` timestamp(14) NOT NULL,
      `ComputerID` mediumint(8) unsigned NOT NULL default '0',
      `LicenseID` mediumint(8) unsigned NOT NULL default '0',
      PRIMARY KEY  (`ID`)
    ) TYPE=MyISAM;
    Note the timestamp field. If you don't use it, Access won't be able to get hold of the table properly.

    Run the query, and the table will be created. You can then link the newly created table in Access.

    Personally, I would do the above ( creating a table ) via ADO. But I suppose a pass-through query is a valid way of doing it too.

  4. #4
    Join Date
    Nov 2003
    Posts
    11
    thank-you all
    so the isuue is that mysql qdbc driver does not support multipre sentences... separates with ;




    OLE .. at least I know what is posibble or not
    I use a now permanent table not a temporary one... but the principle is the same.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •