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)
 Select Statement Error

Author  Topic 

bbowser
Starting Member

43 Posts

Posted - 2007-06-11 : 10:20:36
I'm trying to convert some DB2 statements to work with my MS SQL 2005 db. The DatePre column is a datetime type field. Can someone please help with the correct Where clause?

WHERE TP > 0 AND DATEPRE > '1000-01-01'

I get the error with the datepre field.
Any help would be greatly appreciated. I've tried several changes to no avail.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-11 : 10:24:00
DATEPRE > '1000-01-01'

Do you really store that old data?

Where TP > 0 and DatePre > 0


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-11 : 10:45:59
<<
I get the error with the datepre field.
>>

What is the error?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

bbowser
Starting Member

43 Posts

Posted - 2007-06-11 : 10:50:52
If I try to do a DatePre > '01/01/1900' then I don't seem to get the records I should be.
Go to Top of Page

bbowser
Starting Member

43 Posts

Posted - 2007-06-11 : 10:53:58
Here's what I've tried using only to get the following error.
Where datepre > '#01/01/1000#'

I get a "conversion failed when converting datetime from character string".
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-11 : 10:58:58
# is used in MS ACCESS and not in SQL Server

Where datepre > '01/01/1000'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-11 : 10:59:41
quote:
Originally posted by bbowser

If I try to do a DatePre > '01/01/1900' then I don't seem to get the records I should be.


Can you post some sample data and the result you want?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -