Re: Conversion Problem

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Graham" <graham(at)digitalplanit(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Conversion Problem
Date: 2003-11-13 14:40:11
Message-ID: 200311131440.11688.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thursday 13 November 2003 12:25, Graham wrote:
> Apologies as this probably isn't really for this list but...
>
> In postgresql you can execute a statement such as:
>
> SELECT 1 > 2;
>
> And it would return 'f'
>
> Does anyone know if you can do this in SQL Server as I have to do a
> conversion of some prewritten SQL code.

If you look here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_oa-oz_3qpf.asp

"Unlike other SQL Server data types, a Boolean data type cannot be specified
as the data type of a table column or variable, and cannot be returned in a
result set."

Generally you'd use a BIT type instead of a boolean, but that's not going to
help you here. I'm not even sure if you can use a boolean expression in the
column-list part of a select.

The only thing I can think of is to use a case:
SELECT WHEN 1>2 THEN 1 ELSE 0 END;

As to why MSSQL doesn't support booleans, you could try asking their tech
support, but I wouldn't get your hopes up.
--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christoph Haller 2003-11-13 15:06:05 Re: Conversion Problem
Previous Message George Weaver 2003-11-13 13:29:31 Re: Looks are important