Re: What err ???

From: Joel Burton <joel(at)joelburton(dot)com>
To: Robson Martins <robson-martins(at)bol(dot)com(dot)br>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: What err ???
Date: 2002-06-07 13:45:36
Message-ID: Pine.LNX.4.30.0206070942220.26454-100000@temp.joelburton.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, 6 Jun 2002, Robson Martins wrote:

> What err ???
>
> SELECT RazaoSocial + ' - ' + Iif(Bairro Is Null,'',Bairro + ' ') + CGCCli As Coluna FROM Clientes WHERE RazaoSocial Like '%A%'

Messages like this are better sent to pgsql-general or pgsql-sql, by the
way.

Two problems:

. Strings are concatenated using ||, not +. 'Cat' || 'Dog' => 'CatDog',
whereas 'Cat' + 'Dog' => ASCII result of this (not what you want)

. IIf() is a nonstandard Microsoft function used in Access. SQL databases
use CASE. See the docs for examples on CASE.

- J.
--

Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Independent Knowledge Management Consultant

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ross J. Reedstrom 2002-06-07 14:37:08 Re: What err ???
Previous Message Ferdinand Smit 2002-06-07 12:20:46 Postgres network preformance