Forums

This topic is locked

Else statement not working properly

Posted 03 Sep 2010 17:38:22
1
has voted
03 Sep 2010 17:38:22 Rick Beach posted:
I have two field in to tables set to datetime. The field names are "DateReceived" and "DateIssued". When I run either of the below the SQL View runs properly.

CASE PPEBalance.ID WHEN 2 THEN DateIssued + ExpDays END AS ExpDate
Or
CASE PPEBalance.ID WHEN 2 THEN DateReceived + ExpDays END AS ExpDate

When I attempt to use the below I receive an error message stating "Arethmetic: overflow error converting expression to data type datetime".

CASE PPEBalance.ID WHEN 2 THEN DateIssued + ExpDays ELSE DateReceived + ExpDays END AS ExpDate

How can this be changed to work properly?

Replies

Replied 05 Sep 2010 17:26:01
05 Sep 2010 17:26:01 Natalie Patterson replied:
Rick -

Have you tried converting your date fields in SQL to dates?

CTOD(dateReceived) and CTOD(dateIssued) making the SQL see the date as a date not text.
Replied 07 Sep 2010 15:59:09
07 Sep 2010 15:59:09 Rick Beach replied:
Both have been changed to "Date" previously but I still have the same error.
Replied 07 Sep 2010 17:25:35
07 Sep 2010 17:25:35 Rick Beach replied:
I have found the problem. The ExpDays was set to 9999999 as a default for never expiring. This will not work with this many characters. I will work with only six digits or less. I changed it to 999999 and it works properly.
Replied 09 Dec 2011 13:53:09
09 Dec 2011 13:53:09 karen roore replied:
les maisons sont faites de rondins et d'herbes, it would be the best litteral translation but you would not say this way in French, better: "les maisons sont faites de bois et de pailles" or "les maisons sont en bois et en paille" (wood and hay)....
Rei Coupon Code
Replied 29 Nov 2012 05:56:26
29 Nov 2012 05:56:26 Sabrinai ktorie replied:
My gas heater is not working properly. I have it set to a certain temperature and it will shut off before it gets there.
full article

Reply to this topic