This should do it. Save it in a file then run it like "perl newfile.pl".
Save the output into a text file, then run it against your database.
$records = 100;
for ($i=1;$i<=$records;$i++) {
print "INSERT INTO MyTable (forumid, styleid, title, title_clean, " .
"description, description_clean, options) VALUES\n";
print "($i, 888, 'title $i', 'clean title $i', 'description $i', " .
"'clean description $i', 999);\n"
}
so:
perl newfile.pl > test_records.sql
mysql -p mydatabase < test_records.sql
-Ryan
http://www.stillnetstudios.com
SRM SRM wrote:
>
>
> Group,
>
> I'm an oracle dba and new to mysql. I've just recieved responsiblity
> to work on a mysql project. Basically I have 1 table:
>
> forumid smallint(5) unsigned NO (null) 0 (null)
> styleid smallint(5) unsigned NO (null) 0 (null)
> title varchar(100) NO (null) (null) (null)
> title_clean varchar(100) NO (null) (null) (null)
> description text YES (null) (null)
> description_clean text YES (null) (null)
> options int(10) unsigned NO (null) 0 (null)
>
>
> I need a script that will insert, say 10000, records into this table.
> Note, I dont really care about the content of the data (ie, the title
> could be TITLE1, TITLE2, TITLE3...TITLE10000, whatever). Im just
> interested in populating the table with X amount of rows and being
> able to perform some stress tests.
>
> TIA
>
> _________________________________________________________________
> PC Magazine’s 2007 editors’ choice for best Web mail—award-winning
>
> Windows Live Hotmail.
>
> http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_pcmag_0507
>
>
>
>