Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Message when use comparison's with dates

Status
Not open for further replies.

stubnski

MIS
Nov 17, 2005
403
US
Hey Everyone,
I get this error message -
[C:\Program Files\Microsoft Office\Office\msqry32.exe]
[SQLCODE: <-400>:<Fatal error occured>]
[Cache Error: <<NOLINE>^CacheSql4>]
[Details: <Serverr>](spelled with two rr's on the end)

It only happens when I use comparison operators(=,<>,<=,>=)to compare dates. The funny thing is I can create the query with out any problems, but when I go to refresh the query with new dates it gives me this error. If I take the comparison sign out and replace it with a different sign it will work until you want to refresh the dates again. Then you have to agian change the sign to something else.

Here's the code -

SELECT distinct MEMBER_ACCT.mbr_nam, SH_ACCT.acn, SH_ACCT.sh_sfx, SH_ACCT.open_dt, SH_HIST.tlr_no, MEMBER_ACCT.br_cd,SH_HIST.trn_dt, SH_HIST.trn_cd FROM SQLUser.MEMBER_ACCT MEMBER_ACCT, SQLUser.SH_ACCT SH_ACCT, SQLUser.SH_HIST SH_HIST WHERE MEMBER_ACCT.acn = SH_ACCT.acn AND SH_HIST.acn = MEMBER_ACCT.acn AND ((SH_ACCT.sh_sfx=5) AND (SH_HIST.trn_cd='DP') AND (SH_ACCT.open_dt Between {d '2006-01-01'} And {d '2006-01-31'})AND (SH_HIST.tlr_no Not Like 14) AND (SH_HIST.tlr_no Not Like 99) AND (SH_HIST.trn_dt=SH_ACCT.open_dt))

The bold part of the code is the trouble spot. Any ideas what could be causing this?
TIA

Stubnski

Humans are good students. God created misery, we created computers.
 
What database are you using? If it's not SQL Server, you are posting in the wrong forum.

-SQLBill

Posting advice: FAQ481-4875
 
Yeah I posted in the wrong forum, sorry.

Stubnski

Humans are good students. God created misery, we created computers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top