At the risk of sounding like I'm calling down from an ivory tower,
why on earth would you create a table with 2500 columns?

This isn't a Perl or database problem, it's a design problem.

Revisit your requirements and design a model, then build your
schema.  

Jared

On Monday 25 February 2002 02:52, Petra Steiner wrote:
> Hello!
>
> Maybe I did not search everywhere or not in the right place (but I looked
> and tried very long) to get a solution to the following problem. And I also
> have to admit that I am a total beginner with perl-dbi.
>
> do ("CREATE TABLE ... ) does not work for more than about 2500 columns:
> "DBD::mysql:: db do failed: Too many columns at program.pl ..."
>
> Of course I could do the create table-assignment by a call of
> "system(mysql -e etc.)"  but another problem is that some of my data
> contains quotes and other critical characters, which I thought to handle by
> dbi->quote.
> I attach a reduced and simplified version of the program and am grateful
> for any hints and advice,
>
> Petra Steiner
>
>  use DBI;
>  use DBD::mysql;
>   my($i,
>      $table_name,
>      $DB,
>      $dbh,
>     @fields,
>    );
>      $DB = "petra";
>      $dbh = DBI->connect("dbi:mysql:$DB", "root", "");
>      if (!$dbh) {print "$DBI::errstr ";}
>
>     @fields = ();
>     for ($i = 1; $i <= 4000; $i++)
>     {
>      push @fields, "n$i"; }# spaltennamen ; colnames
>
>      print "@fields ";
>      $table_name = "tabelle";
>      $dbh -> do("DROP TABLE if EXISTS $table_name");
>      $dbh -> do("CREATE TABLE $table_name (" .
>
>                   join (", ", map {"$_ TINYTEXT"} @fields) . "
>                   )");
>      $dbh -> disconnect;
>      exit(0);
>
>
> -
> ---------------------------------------------------
> Petra Steiner
> Arbeitsbereich Linguistik
> Universitaet Muenster
> Huefferstrasse 27
> 48149  Muenster
>
> Tel: 0251 / 83 39442
> [EMAIL PROTECTED]

Reply via email to