SQL Server日期类型在MS Access中显示为文本字段 [英] Sql Server date type appears as text field in MS Access

查看:155
本文介绍了SQL Server日期类型在MS Access中显示为文本字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MS Access 2010前端数据库/SQL Server 2012后端数据库,在不同的表中有许多日期字段.有时我需要存储时间,因此我使用了数据类型为datetime或smalldatetime.但是某些字段仅需要存储日期,因此我使用了数据类型Date.

I have a MS Access 2010 front end / SQL Server 2012 back end database, with a number of date fields in different tables. Sometimes I need to store the time, so I have used data types datetime or smalldatetime. However certain fields only need to store the date, so I used data type Date.

我的问题是,在MS Access中,我的ODBC链接表将日期"数据类型字段显示为文本".然后,这会导致一些日期以yyyy-dd-mm格式存储而另一些日期以yyyy-mm-dd格式存储的问题.

My problem is that in MS Access, my ODBC-linked table shows the Date data type fields as Text. This is then leading to problems with some dates being stored in the yyyy-dd-mm format and others in the yyyy-mm-dd format.

这是一个错误吗?我需要使用smalldatetime吗?

Is this a bug? Do I need to use smalldatetime?

感谢您的协助, 吉姆

推荐答案

我自己在链接Access 2007和SQL Server 2008时也遇到了同样的问题.

Had the same issue myself linking Access 2007 and SQL Server 2008.

如果您查看艾伯特,请参见此问题. D. Kallal对第一个答案的评论,它告诉我们问题出在过时的驱动程序将前端连接到后端.

See this question, if you look at Albert D. Kallal's comment to the first answer, it tells us that the problem is with an outdated driver connecting the front end to the back end.

如果您无法选择最新的驱动程序(请记住,即使可以,其他客户端计算机上数据库的其他用户也可能无法使用),解决方法是使用datetime数据类型.

If you aren't able to choose an up-to-date driver (and bear in mind that even if you can, other users of your database on different client machines may not be able to) the workaround is to use datetime data type in every case.

这篇关于SQL Server日期类型在MS Access中显示为文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆