Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Time Span condition is not working

Author  Topic 

zhshqzyc
Posting Yak Master

240 Posts

Posted - 2009-04-20 : 18:38:29
I have a sql script which like


select * from table1 where ts between '4/20/2009 00:00:00' and '4/21/2009 00:00:00'




It works in my machine but failed in our lab which has the same version sql server.
And sometimes it is okay.

Here ts='4/20/2009 5:30:36 PM'
Why?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-04-20 : 18:46:46
Are you getting an error? Incorrect results? Something else? We're not clear on what you mean by "failed".

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

zhshqzyc
Posting Yak Master

240 Posts

Posted - 2009-04-20 : 18:49:39
No error.
Just null rows displaying.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-04-20 : 18:50:13
We'll need your actual query as well as sample data and the expected result set.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

theboyholty
Posting Yak Master

226 Posts

Posted - 2009-04-21 : 06:32:50
If you're moving the query to a different environment, are you sure there's actually some data in there for it to return?

---------------------------------------------------------------------------------
http://www.mannyroadend.co.uk. The official unofficial website of Bury Football Club
Go to Top of Page
   

- Advertisement -