Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在一个 int 表中有一个 Date 字段。该值如下所示: 20130618 我希望能够将其转换为实际日期,例如 06/18/2013,以便对其进行日期计算。如何转换该字段?
select convert(date, left(20130618, 8), 101)
或者
select convert(date, cast(20130618 as char(8)), 101)