'table' Tag

  • Generating an arbitrary number of rows for a test table

    July 23, 2009

    Quick and dirty approach to generate an arbitrary number of rows of test data in two-column table, where one column should not be unique:
     
    1> CREATE TABLE
    <table_name> (id int,whatever varchar(10))
    2> go
    1> INSERT
    <table_name> VALUES (rand() * 1000000, ‘Datarow’)
    2> go 2560
     
    This will insert 2560 rows into the table “table_name” with unique values for the first column.

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org