August 26, 2005 at 6:00 pm
I have a spreadsheet with Date1 Offer1 Receipt1 Date2 Offer2 Receipt2 ... all the way to Date8 Offer8 Receipt8. I would like to create a table listing Date Offer Receipt. I have tried SELECT Date1 & Offer1 & Receipt1 from XYZ UNION SELECT Date2 & Offer2 & Receipt2 from XYZ ... all the way through to UNION SELECT Date8 & Offer8 & Receipt8 from XYZ WHERE etc.
Have I got this approach all wrong? I'm a real newbie to all of this!
Cheers Bill
August 26, 2005 at 6:40 pm
Suggest you import the spreadsheet into SQL Server "as is" and then normalise. Your general approach should work though:
insert into tblNormalised(date, offer, receipt)
select date1, offer1, receipt1 from imported union
select date2, offer2, receipt2 from imported union
.... etc etc ........
You may need to put WHERE clauses against each of the SELECTs to avoid bringing in any blank records (unless all 8 repeats are always populated).
August 27, 2005 at 5:11 pm
Thanks very much, realise now that I was using & instead of commas and had to "declare" name for table with its contents, silly me. I'm still learning.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply