SQL Server Cannot Call Methods on Date

后端 未结 11 1454
时光取名叫无心
时光取名叫无心 2020-12-16 10:41

I\'ve got a DATETIME column in a SQL Server 2008 table called ShiftDate. I want to convert this to a DATE column in a query:

SELECT     ID, ScheduleID, Shift         


        
11条回答
  •  天涯浪人
    2020-12-16 11:10

    Sometimes this works...

    CAST(CAST(YourDate AS char(10)) AS Datetime)
    

    (Yes I know it is not Date, but it is one step closer)

    In the same query, it worked in the outside select, but not inside the union all...

    Don't ask why :P

提交回复
热议问题