SQL Builder Error – Incompatible Types

Asked By 0 points N/A Posted on -
qa-featured

Hey techyv experts,

I am new to SQL and trying to learn everything about it. When I was trying to generate SQL Statements using the SQL Builder and selected two join columns, I encountered this error message:

Incompatible Types
                 IWAQ0004W Join types not compatible
                The type of column DEPTNO is CHAR
                The type of column SALARY is DECIMAL

When I tried to use the drag-and-drop method to create a join directly from the Table window by hovering over the desired join column on one table and releasing the mouse button on the join column on the target table, this error message still appeared.

What could be the cause of this and how can I avoid this kind of error? I hope someone can help me. Any help would be appreciated.

Thanks.

SHARE
Best Answer by mosesnyota
Best Answer
Best Answer
Answered By 0 points N/A #84346

SQL Builder Error – Incompatible Types

qa-featured

Hi Collin,

  • The error you are getting occurs when you try to create a join on tables that do not have columns of the same data type. From the error: the column DEPTNO is of type CHAR while the column SALARY is of type DECIMAL.
  • MAYBE I SHOULD FIRST EXPLAIN WHAT A JOIN IS:
  • Basically, a join is the combining of two tables based on the comparative values in the selected columns. So, the columns you select to implement a join should contain information that can tie the two tables together and as such, the columns should be of the same data type.
  • Example: table EMPLOYEE_DETAILS may have a column emp_id of type int , table SALARY may also have a column named emp_id of type int.
  • Both tables have a field EMP_ID; it’s through such a shared column relationship-such as this- that tables can be joined together, so always remember this when creating tables that you want to create joins later.

Regards,
Moses.

Hoping this will be of help to you, but in case of anything, feel free to ask.

Answered By 0 points N/A #84347

SQL Builder Error – Incompatible Types

qa-featured

Incompatible types means you want the two columns to have its relationship but they are not compatible with each other because of their "Datatype". When you are joining two columns you must bear in mind that they must be compatible in types, like you cannot multiply a character with a decimal. You must first take note of the compatibility of their data types when you are relating two columns. This can be avoided by planning efficiently your database design. You need to change the data type of the DEPTNO into integer in order for them to be joined.

Login/Register to Answer

Related Questions