I am stuck with this one...
I have a rather simple table with ZIP-codes and a responsible branch-office. When I enter a zip-code, I recieve the branch-city, just as designed. But, I need the text 'error' returned if the zip-code is not valid. I don't know about the USA, but in Austria, EU, there are about 2300 valid 4-number zip-codes, and 6700 unused codes.
There is an application which accesses the SQL 2000 server by ODBC, and that application needs a value returned. This application sends a SQL query to the server, and interprets the return value.
Example:
1100 Wien
1200 Wien
2345 Linz
When queried for '1200', 'Wien' should return (this works of course), but when '1234' is queried, 'error' should return...
Can someone help me, or point me in th right direction?
SELECT COALESCE((SELECT DISTINCT City FROM Person.Address
WHERE PostalCode = 'MyPostalCode') , 'ERROR')
|||Thanks! that was the clue! Now I can use"SELECT COALESCE ( ( SELECT Route FROM qry_PLZ_Route WHERE plz = 1100 ) , -1 ) AS Route" (plz is german abbr for zipcode) in the application, which is manageable.
Thanks for your help!
No comments:
Post a Comment