SQL View syntax question

Hello all,

I have a view that has records such as this:

SELECT  ExchangeRateDate, CurrencyCode, ExchangeRate FROM ExchangeRate
ExchangeRateDate    CurrencyCode     ExchangeRate
2/19/2015                    GBP                      1.1255
2/19/2015                    ANG                      0.6522
2/20/2015                    GBP                      1.3525
2/20/2015                    ANG                      0.7525
2/23/2015                    GBP                      1.8525
2/23/2015                    ANG                      0.4525

Problem is the source table does not store weekend exchange rates.   What I want to do is carry forward any Friday record to the Saturday and Sunday so creating records for this where in the above example I would have 4 more records.   How can I accomplish this in my view?
sbornstein2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Scott PletcherSenior DBACommented:
SELECT DATEADD(DAY, day_adjustment, er.ExchangeRateDate) AS ExchangeRateDate, er.CurrencyCode, er.ExchangeRate
FROM ExchangeRate er
OUTER APPLY (
    SELECT 0 AS day_adjustment, 'Fri' AS day_base
    UNION ALL
    SELECT *
    FROM (
        SELECT 1 AS day_adjustment, 'Sat' AS day_base UNION ALL
        SELECT 2, 'Sun'
    ) AS derived
    WHERE DATEDIFF(DAY, 0, er.ExchangeRateDate) % 7 = 4 --Fri
) AS oa1
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
sbornstein2Author Commented:
awesome thanks Scott
0
sbornstein2Author Commented:
thanks
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

From novice to tech pro — start learning today.