Skip to content Skip to sidebar Skip to footer

Why Does My Query Generate An "undefined Name" Error With Sqlcode -204?

This is a SQL Server query select Letter, COUNT(*) from #Letters LEFT JOIN Emp ON Name LIKE Letter + '%' group by Letter but it would not run in DB2, giving an error message: 'MO

Solution 1:

You have not table with #LETTERS into your database and into MOHIT Library. May be into a other Library?

Note: #Tablename are for temporary table in SQL Server, in DB2 its just a table

Note 2: '+' are not an operator of concatenation in DB2, use '||'

your query should be

select Letter, COUNT(*)
from #Letters
LEFTJOIN Emp ON Name LIKE Letter ||'%'groupby Letter

Of course your table shoud be exist in list of Library loaded

Post a Comment for "Why Does My Query Generate An "undefined Name" Error With Sqlcode -204?"