Re: Conversion Problem

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Conversion Problem
Дата
Msg-id 200311131440.11688.dev@archonet.com
обсуждение исходный текст
Ответ на Conversion Problem  ("Graham" <graham@digitalplanit.com>)
Список 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 по дате отправления:

Предыдущее
От: Christoph Haller
Дата:
Сообщение: Re: Conversion Problem
Следующее
От: "Louise Cofield"
Дата:
Сообщение: Re: Looks are important