我今天要用什么来查询? [英] WHAT DO I USE TO MAKE A TODAY DATE QUERY?
问题描述
从dbo.membre中选择no_dossier,其中date_MAJ = GETDATE()
从dbo.membre中选择no_dossier,其中date_MAJ ='''2005-07-21''
两者都应该给我相同的结果,是或否?
谢谢
select no_dossier from dbo.membre where date_MAJ = GETDATE()
select no_dossier from dbo.membre where date_MAJ = ''2005-07-21''
Both should give me the same result, yes or no?
thanks
推荐答案
" Fernand St-Georges" < FE **************** @ videotron.ca>在消息中写道
新闻:QG ******************** @ weber.videotron.net ...
"Fernand St-Georges" <fe****************@videotron.ca> wrote in message
news:QG********************@weber.videotron.net...
从dbo.membre中选择no_dossier,其中date_MAJ = GETDATE()
从dbo.membre中选择no_dossier,其中date_MAJ =''2005-07-21''
两者都应该给我是相同的结果,是或否?
感谢
select no_dossier from dbo.membre where date_MAJ = GETDATE()
select no_dossier from dbo.membre where date_MAJ = ''2005-07-21''
Both should give me the same result, yes or no?
thanks
否。第一个GETDATE()也返回一个时间组件。
请选择GETDATE(),''2005-07-21''以查看差异。
No. The first GETDATE() returns a time component too.
Do select GETDATE(), ''2005-07-21'' to see the difference.
我知道,但问题是我无法检索我想要的数据,因为我使用
从dbo.membre中选择no_dossier其中date_MAJ = GETDATE()
它只是没有返回任何东西,但它确实如果我使用日期像
这个''2005-07-21''
我是什么做错了?如果我在Access中使用date(),它工作正常。
***通过Developersdex发送 http://www.developersdex.com ***
I know, but the problem is I cannot retreive the data I want as I use
select no_dossier from dbo.membre where date_MAJ = GETDATE()
it just does not return anything, but it does if I use the date like
this ''2005-07-21''
what am I doing wrong? it works fine if I use date() in Access.
*** Sent via Developersdex http://www.developersdex.com ***
Fernand St-Georges(fe ******* *********@videotron.ca)写道:
Fernand St-Georges (fe****************@videotron.ca) writes:
我知道,但问题是我无法检索我想要的数据,因为我使用
从dbo中选择no_dossier。 membre where date_MAJ = GETDATE()
它只是没有返回任何东西,但它确实如果我使用日期像
这个''2005-07-21''
<我做错了什么?如果我在Access中使用date(),它工作正常。
I know, but the problem is I cannot retreive the data I want as I use
select no_dossier from dbo.membre where date_MAJ = GETDATE()
it just does not return anything, but it does if I use the date like
this ''2005-07-21''
what am I doing wrong? it works fine if I use date() in Access.
你做错了什么?好吧,你现在知道getdate()将会给你一个时间组件,现在你问为什么它没有b $ b工作?
无论如何,去掉时间组件的最好方法是:
convert(char(8),getdate(),112)
-
Erland Sommarskog,SQL Server MVP, es****@sommarskog.se
SQL Server SP3联机丛书
http://www.microsoft.com/sql/techinf...2000/books.asp
这篇关于我今天要用什么来查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!