July 30, 2008 at 7:40 pm
Hi,
I think this is pretty common, but I don't know what it's called so I can't search for it.
I have a client who keeps records of Students in excel files. My job is to pull them out and create a SQL Server database for them. These files all have columns like ClassTaken1, ClassTaken2, ClassTaken3 etc., somtimes up to a dozen or two of them. Obviously I want to pull that data out of the flat file and create a related table for Student Enrollment.
I thought what I was looking for was called PivotTables, but it turns out that that's kind of the opposite. Any idea what this is called? Thanks.
Aaron
July 30, 2008 at 8:28 pm
You're trying to UNPIVOT or re-normalize your data. The 2005 method is the UNPIVOT; past versions would require a series of SELECT statements smushed together with UNION or UNION ALL.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
July 30, 2008 at 8:44 pm
Heh... reminds me of a dictionary... how can you check the spelling on a word using a dictionary without a bit of luck?
I agree with Matt... UNPIVOT is what you're most likely looking for. There's some other ways to do it, as well but, since you're using 2k5, that's as good as any a place to start.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply