Query to Normalize data for reporting

I am working with a system whose structure I am unable to change.  I want an effecient way to "Denormailze" some of the data for easire reporting.
The attributes needed are ProjectID, BudgetDate, BudgetAmount.
The table has BudgetDate01 through BudgetDate24 and BudgetAmount01 through BudgetAmount24.
I want a view or a temporary table that has 3 attributes ProjectID, BudgetDate, BudgetAmount.  The result set would containt 24 times teh number of records as the original table.  It would be ok to lessen this by including only non zero amounts.
I know I can do a big union query where I type in all of the 01 through 24 fieldnames in 24 individaul sets with a union, is there a more effecient way?  
ehollemanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Patrick MatthewsCommented:
>>I want an effecient way to "Denormailze" some of the data for easire reporting.

Actually, based on your description, the data are already denormalized, and what you want to do is normalize it.

>>I know I can do a big union query...is there a more effecient way?

Not really.  The union approach is absolutely what I would do.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ehollemanAuthor Commented:
Yes, I want to normalize, not denormalize, typed teh wrong thing.
Does anyone have any more thoughts?I
If it is a big ol' union, can I put in some kind of loop as the fieldnames go from 01 - 24.  
0
Patrick MatthewsCommented:
You could do a loop, but that will require dynamic SQL, and will be less efficient than simply running the union query.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.