我有一个SQL数据库(2012),我试图通过R(R Studio)访问.从企业管理器这是它的样子:
select top 5[date],value from dbo.history
1991-02-11 11.1591
1991-02-12 11.2
1991-02-13 11.3501
1991-02-14 11.37
1991-02-15 11.3002
Run Code Online (Sandbox Code Playgroud)
但是从R来看,这就是我得到的:
sqlQuery(DF_CN,'select top 5 [date],value from dbo.history')
date value
1 0011-02-19 11.16
2 0012-02-19 11.20
3 0013-02-19 11.35
4 0014-02-19 11.37
5 0015-02-19 11.30
Run Code Online (Sandbox Code Playgroud)
当我尝试从表中选择所有数据时,这就是我得到的
sqlQuery(DF_CN,'select * from dbo.history')
Error in charToDate(x) :
character string is not in a standard unambiguous format
Run Code Online (Sandbox Code Playgroud)
它可能是关于SQL服务器的yyyy-mm-dd默认格式的东西,如果我使用的话我可以更改CONVERT,但这看起来像黑客而且SELECT *不起作用.
RI中有什么东西可以识别SQL Server日期吗?
本
这让我疯了 - 当然有人已经看过这个 - 在SQL Server输出和R读取之间有明显的脱节.
我使用的是RStudio 0.98.1091和R x64 3.1.2.Sql Server 2014 …