Re: Conversion Problem - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Conversion Problem
Date
Msg-id 200311131440.11688.dev@archonet.com
Whole thread Raw
In response to Conversion Problem  ("Graham" <graham@digitalplanit.com>)
List 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


pgsql-sql by date:

Previous
From: Christoph Haller
Date:
Subject: Re: Conversion Problem
Next
From: "Louise Cofield"
Date:
Subject: Re: Looks are important