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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Receiving a 'varchar' error

Status
Not open for further replies.

rougex

Technical User
Nov 7, 2006
19
0
0
US
Hi all!
I am writing a CASE statement in the Reportsmith software to 'rename' or 'update' field values...see below

CASE (LOC.LOCATION) WHEN 'C07' THEN 'NRG' ELSE 0 END

it is returning the following:

Syntax error converting varchar value 'NRG' to a column of data type int.

What does this mean and how can I fix?

Any assistance or guidance is appreciated.
~jg
 
CASE (LOC.LOCATION) WHEN 'C07' THEN [!]'NRG'[/!] ELSE [!]0[/!] END

This could return a string or an int. You can't do this. The simple thing to do would be to...

[tt][blue]
CASE (LOC.LOCATION) WHEN 'C07' THEN 'NRG' ELSE [!]'[/!]0[!]'[/!] END
[/blue][/tt]

With the single quotes around the zero, a string will be returned.


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Try this:

Code:
CASE (LOC.LOCATION) WHEN 'C07' THEN 'NRG' ELSE '0' END

Everything in a case statement needs to be the same datatype

Good Luck,

Alex

Ignorance of certain subjects is a great part of wisdom
 
woo hoo!!!!!!!!

So simple, yet not.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top