In MySQL, and also Transact-SQL (Sybase or SQLServer), you can use both ISNULL and COALESCE to use a default in case you have NULL values:
select IFNULL('pepe', 123); ----------- NULL
For right interaction with proxy-tables in SAP Sybase, must use better than null simple check:
USE COALESCE: due is ANSI standard. So if you think you might have to port the code to another DBMS, it’s a safer bet. Works as espected in both sybase and mysql, also another stupid like micosoft.AVOIT ISNULL: due in MySQL returns boolean depends of configuration an version. This boolean if the result are miscinterpreted can be trheated as "0" char and think if zero value. Sybase does not assume "question" behavior, whientime MySQL assumes a "question" like "this fiel are null "or not" and return "true" (yes its null) or false (no ther'n).
The problem resides in that coalesce it for experts...
sybase> select IFNULL('pepe', 123); ----------- NULL mysql> select IFNULL('pepe', 123); ----------- pepe
here with coalesce in mysql expected are good:
sybase> select COALESCE('pepe', 123); ----------- 'pepe' mysql> select COALESCE('pepe', 123), ; ----------- 'pepe'
No hay comentarios.:
Publicar un comentario
no stupid winbuntu users allowed!