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

IF Statement Question in Pervasive

Status
Not open for further replies.

SQLDBA007

Technical User
Aug 20, 2007
2
US
Hello!

I am trying to fix this IF statement error. All i want is the value of column 'Column2' to display if column 'Column1' = y.

IF (Column1 = 'Y', Column2 , '0') "ColumnTEST",

The data type for column2 is numericsts and the data type for Column1 is char.

This is the error message i get:
ODBC Error: SQLSTATE = S1000, Native error code = 0
Incompatible types in expression.

What am i doing wrong here? the SQL statement seems fine, to me. Any thoughts and comments are highly appreciated. Thanks in Advance!
 
You'll probably need to Cast (or convert depending on the version of PSQL) the Column2. So something like:
IF (Column1='Y',Convert(Column2,SQL_CHAR), '0') "ColumnTEST",





Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top