Fraser Dowall

Rants and musings of a B.I. Professional

About

Proin accumsan urna in mi. Aenean elementum egestas tortor. Donec neque magna, auctor a, dapibus sit amet, facilisis sit amet, ligula..

Archive for the 'Code and Snips' Category

Converting a date CYYMMDD to and from

Monday, December 15th, 2008

  I ran into a customer using the old Y2K Date that I hhadn’t seen for a while and thought that I would take a moment to blog how to convert to and from. TO :  CASE WHEN SUBSTRING(CAST(dKey_TimeByDay AS VARCHAR),1,1) = 2 THEN ’1′+ SUBSTRING(CAST(dKey_TimeByDay AS VARCHAR),3,6)  ELSE ’0′ + SUBSTRING(CAST(dKey_TimeByDay AS VARCHAR),3,6) END [...]

Read the rest of this entry »