I have a numeric column in SQL which I need to convert to a date. The field is currently coming into the database as: "20181226.00000"
.
I only need to the characters before the " . "
. So i did a SUBSTRING - CHARINDEX
looking for anything before the " . "
. I then did a cast as NVARCHAR
.
Now I'm getting 20181226
but I want this date field to populate like:
"MM/DD/YYYY"
.
My current SQL is:
CONVERT(VARCHAR(10),SUBSTRING(CAST('MYFIELD' AS NVARCHAR(50)) ,0, CHARINDEX('.', 'MYFIELD' , 0)),101)