X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id A693AD1B55F for ; Thu, 13 Nov 2003 14:40:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 49482-08 for ; Thu, 13 Nov 2003 10:40:15 -0400 (AST) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by svr1.postgresql.org (Postfix) with ESMTP id 1469AD1B535 for ; Thu, 13 Nov 2003 10:40:11 -0400 (AST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) id 1AKIdq-000Gbd-0U; Thu, 13 Nov 2003 14:40:14 +0000 Received: by mainbox.archonet.com (Postfix, from userid 529) id 9BC8617363; Thu, 13 Nov 2003 14:40:13 +0000 (GMT) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 3BCBF17332; Thu, 13 Nov 2003 14:40:12 +0000 (GMT) From: Richard Huxton To: "Graham" , Subject: Re: Conversion Problem Date: Thu, 13 Nov 2003 14:40:11 +0000 User-Agent: KMail/1.5 References: <0fc401c3a9e1$2e6ee0a0$6864a8c0@GVICKRAGE> In-Reply-To: <0fc401c3a9e1$2e6ee0a0$6864a8c0@GVICKRAGE> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200311131440.11688.dev@archonet.com> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.15.3 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/153 X-Sequence-Number: 15968 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