I'm using SSMS 2012 and I'm simply trying to convert a datetime2(7) field to a date field - however, no matter how I try, the spreadsheet (Excel 2016) I have linked to it returns the field as text. I'm at my wit's end! I've tried:
SELECT CONVERT(datetime2(7), dbo.SchoolDays.DayDate, 103) AS DayDate
SELECT CAST(dbo.SchoolDays.DayDate AS date) AS DayDate
SELECT CAST(CONVERT(datetime2(7), dbo.SchoolDays.DayDate, 103) AS date) AS DayDate
And some other functions - too many to list here as I've been at it for two hours.
I really need it to come across into the linked spreadsheet as a date, as I want the entries returned to be limited to a date range entered on the spreadsheet in a particular cell.
Any suggestions please?