Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 creating dummy data
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

imtiluin ao
Starting Member

1 Posts

Posted - 07/31/2012 :  00:52:27  Show Profile  Reply with Quote
any sql expert here to help me out?? i have a problem here:
my file contains:
1. 6 lakhs family datas.
2. 5 members in each family.
3. the existing data has only 1 to 2 members.

my conditions are:
1.i want to create dummy rows in each data(family) example..: if a family has serial no. 1 and 2 then we have to create a dummy for sl no. 3,4 and 5.
2. if a family has serial no. 1 and 3 then we have to create a dummy for sl no. 2,4 and 5.

Aged Yak Warrior

940 Posts

Posted - 07/31/2012 :  01:52:42  Show Profile  Reply with Quote
The first bit is easy enough:

This (or something like it) gets you all combinations of family & serial number that are not in your table.

select * from
(select * from
(select distinct FamilyID from family) as FID,
(select 1 as serialNo union all select 2 union all select 3 union all select 4 union all select 5) as serialNos
) z -- Z is all combinations of family & serial #
left outer join Family F on (F.familyID=z.familyID and F.serialNo=z.serialNo)
where z.familyID is null

You'll have to work out yourself how to dummy up the data but you can use that as a start point.
(I have not run or tested it because you did not give me any tables).
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000