请注意,在将此标记为重复之前,我已多次阅读此帖子the first thing that always pops up in google但我不认为它解决了我的问题。
在通过ODBC传递查询到SQL Server 2008 R2 ...
此DOES有效:
(SELECT x, convert(date, y) FROM so_q1);
但这不起作用:
(SELECT x, (cast y as date) FROM so_q1);
知道为什么吗?
答案 0 :(得分:3)
(SELECT x, (cast y as date) FROM so_q1);-- does not work because it is the incorrect syntax.
(SELECT x, cast( y as date) FROM so_q1); --works just fine.
谢谢@AlexK