SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

imtiluin ao
Starting Member

India
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 sl.no 2 then we have to create a dummy for sl no. 3,4 and 5.
2. if a family has serial no. 1 and sl.no 3 then we have to create a dummy for sl no. 2,4 and 5.

LoztInSpace
Aged Yak Warrior

938 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  
 New 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.05 seconds. Powered By: Snitz Forums 2000