How Do I Fix A Implicit conversion Error

50 pts.
Tags:
Implicit Conversion Error
SQL
I got the following error on the first line and I'm not sure why. The appropriate fields in both tables (oas_balance and oas_testit) have the same data-types. Could it be an out of order thing? ERROR: Implicit conversion from data type varchar to money is not allowed. Use the CONVERT function to run this query. SELECT DISTINCT oas_balance.cmpcode, oas_balance.el1, oas_balance.el2, oas_balance.full_value, CASE WHEN balcode = 'ACTUAL' AND yr = '2008' And period = '6' AND IsNull(full_value, '') = '' THEN 0 ELSE full_value END AS Act_Amt, CASE WHEN balcode ='BUDGET' AND yr = '2008' And period ='6' AND IsNull(full_value, '') = '' THEN 0 ELSE full_value END AS Bud_Amt, CASE WHEN balcode ='ACTUAL' AND yr = '2008' - 1 And period = '6' AND IsNull(full_value, '') = '' THEN 0 ELSE full_value END AS LY_Amt, CASE WHEN balcode ='ACTUAL' AND period <= '6' And yr = '2008' AND IsNull(full_value, '') = '' THEN 0 ELSE full_value END AS ActYtd_Amt, CASE WHEN balcode ='BUDGET' AND period <= '6' And yr = '2008' AND IsNull(full_value, '') = '' THEN 0 ELSE full_value END AS BudYTD_Amt, CASE WHEN balcode ='ACTUAL' AND period <='6' And yr ='2008'-1 AND IsNull(full_value, '') = '' THEN 0 ELSE full_value END AS LYYTD_Amt, oas_balance.balcode, oas_balance.yr, oas_balance.period, oas_balance.repbasis INTO oas_testit FROM oas_balance WHERE oas_balance.cmpcode ="FORNAIO" AND oas_balance.el1 >"39999" AND (oas_balance.balcode ="ACTUAL" Or oas_balance.balcode ="BUDGET") AND (oas_balance.yr = '2008' Or oas_balance.yr = '2008'-1) AND oas_balance.period <='6' AND oas_balance.repbasis ='3';
ASKED: August 14, 2008  12:37 AM
UPDATED: August 14, 2008  1:27 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

The problem is the IS_NULL functions that I pointed you towards.

I didn’t release the data types in the prior post.

You can’t have a blank value in a field which is a numeric data type (of which the money data type is one).

Try changing the IS_NULL functions to this.

<pre>SELECT DISTINCT oas_balance.cmpcode, oas_balance.el1, oas_balance.el2, oas_balance.full_value,
CASE WHEN balcode = ‘ACTUAL’ AND yr = ’2008′ And period = ’6′ AND IsNull(full_value, -1) = -1 THEN 0 ELSE full_value END AS Act_Amt,
…</pre>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following