pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Graham <graham@digitalplanit.com>
To: pgsql-sql@postgresql.org
Subject: Re: Conversion Problem
Date: Thu, 13 Nov 2003 14:40:11 +0000
Message-ID: <200311131440.11688.dev@archonet.com> (raw)
In-Reply-To: <0fc401c3a9e1$2e6ee0a0$6864a8c0@GVICKRAGE>
References: <0fc401c3a9e1$2e6ee0a0$6864a8c0@GVICKRAGE>

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



view thread (3+ messages)  latest in thread

Message-ID: <200311131440.11688.dev@archonet.com>
Permalink:  ../200311131440.11688.dev@archonet.com/
Also on:    postgresql.org/message-id/200311131440.11688.dev@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, graham@digitalplanit.com
  Subject: Re: Conversion Problem
  In-Reply-To: <200311131440.11688.dev@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox