Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating test data
Message
From
01/11/2006 18:42:10
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
01/11/2006 14:59:46
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01166318
Message ID:
01166442
Views:
15
>Hi,
>
>I'm fairly new to SQL Server.
>
>I have a table with 300,000 odd records and for testing I am trying to use this data to increase the number of records 5 fold so I'll end up with approx 1.5 million records.
>
>So I can do this:
>
>INSERT INTO ()
>SELECT
>FROM
>
>My difficulty is that one of the fields is a varchar(50) field that stores a unique number from a form (something like an invoice number), so I need to generate a unique number for each record.
>
>Any suggestions how to do this?
>
>Thanks,

Frank,
create a temp table with an char(1) field. Insert 5 records (ie: A,B,C,D,E). Then select from both tables with a full join into a new table. I guess it'd be a fast way to generate 1.5 million records. ie:
create table #tmp (f1 char(1))
insert into #tmp select 'A'
insert into #tmp select 'B'
insert into #tmp select 'C'
insert into #tmp select 'D'
insert into #tmp select 'E'

// you can get and edit this if you right click your table and script as select
// instead of typing all fields
select myTable.field1, myTable.field2, t2.f1+myTable.uniqueField as uniqueField 
 from myTable, #tmp t2
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform