daily pastebin goal
27%
SHARE
TWEET

DateTime Reversed

SQLSoldier Jun 15th, 2017 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Declare @DT varchar(35) = '1:30:21 PM 3/29/2017';
  2.  
  3. Select Cast(Right(@DT, Len(@DT) - Charindex(' ', @DT, Charindex(' ', @DT) + 1)) +
  4.     space(1) + LEft(@DT, Charindex(' ', @DT, Charindex(' ', @DT) + 1)) as datetime);
RAW Paste Data
Top