SQL查询WHERE DATE ='' [英] SQL Query WHERE DATE = ' '

查看:632
本文介绍了SQL查询WHERE DATE =''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能是一个关于冗余技术的老问题...

Probably an old question about redundant technology...

我有MS Project Standard 2003.我正在使用VBA从(很多).mpp文件中读取数据,与Project.OLEDB.11.0的ADODB连接,尝试通过连接对象的Execute方法创建ADODB Recordset,其参数类似于"SELECT  CostStandardRate
FROM CostRates WHERE CostToDate< '01 / 01 / 2009’ "我已经尝试了日期的每个字符组合,并尝试放置一个变量(... WHERE CostToDate ='"& dt&'") 并且它总是返回整个表格或EOF。我也尝试了CAST和
CONVERT,但我可能没有足够的研究那些以确保 我正确使用它们。有人可以请告诉我我应该为日期输入的确切字符串,以获得正确的记录集。

I have MS Project Standard 2003. I am reading data from (lots of) .mpp files using VBA, making an ADODB Connection with Project.OLEDB.11.0, trying to make an ADODB Recordset by the Execute method of the connection object, with an argument a lot like "SELECT CostStandardRate FROM CostRates WHERE CostToDate < '01/01/2009'" I have tried every combination of characters for the date, and tried putting a variable (...WHERE CostToDate = '" & dt & '") and it always returns the whole table or EOF. I also tried CAST and CONVERT but I probably didn't study those enough to be sure I used them correctly. Can somebody please tell me the exact string that I should put in for the date, to get the right recordset.

在这个论坛上搜索的任何提示都会很方便,当我在搜索和阅读方式中输入此标题时,我获得了超过750次点击,这与太多无关我的问题。

Any tips for searching on this forum would be handy, I got more than 750 hits when I entered this title in the search and read way too many that had nothing to do with my problem.

在我们聊天的时候,我很确定我将不得不从2003年开始升级。其中一天。这将是一个问题  ;因为我们现在已经很好地使用了MS Access,我明白2010年不再这样做了。
我们的组织不会获得企业。它很漂亮,我们知道这一点,如果某个办公室的一些人不仅仅在​​一个"竞争"产品上烧掉了大约十年的IT资本投资,那么我们可能会得到它(完成在奥迪实施
顾问) )即将卸载。因为它什么都不做。如果我想创建一个类似于我现在拥有的系统,使用Project Professional 2010 for .mpp文件,以及一个数据库到
做报告和事情,这将是一个很好的起点?没有Project.OLEDB.14.0,甚至没有.12?

While we're chatting, I'm pretty sure I'm going to have to upgrade from 2003 one of these days. This is going to be a problem because we've got it all working really well with MS Access now, and I understand that 2010 doesn't do that anymore. Our organisation is not going to get Enterprise. It is beautiful, we know that, and we probably would get it if SOMEBODY AT HEAD OFFICE hadn't just burned about ten years worth of IT Capital Investment on a 'competing' product (complete with implementation consultants in an Audi) that is about to get Uninstalled. Because it doesn't do anything. What would be a good starting point if I wanted to create a similar system to the one I have now, with Project Professional 2010 for .mpp files, and a database to do reports and things? There is no Project.OLEDB.14.0 is there, not even a .12?

谢谢,喜欢这个论坛。

推荐答案

我在OLEDB语句中使用WHERE获得了混合成功。一般来说,与Access或SQL Server交谈我总是发现yyyy-mm-dd格式最安全,所以继续试验。

I had mixed success using WHERE in OLEDB statements. In general, talking to Access or SQL Server I've always found yyyy-mm-dd format safest, so keep experimenting.

正确,Project 2007和2010不支持OLEDB。因此,前面只有两个更简单的解决方案:

Correct, Project 2007 and 2010 do not support OLEDB. So, there are only two simpler solutions going forward:

1)将每个项目文件导出为xml,然后从那里读取数据。

1) Export each project file as xml then read data from there.

2)写用于将数据直接导出到Access或SQL Server数据库的VBA代码。您只需要导出报告所需的内容,因此速度非常快。

2) Write VBA code to export data directly to your Access or SQL Server database. You only need to export what you need for reporting, so it's quite quick.


这篇关于SQL查询WHERE DATE =''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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