[dba-SQLServer] SQL Server - Turning comparisons into Booleans

James Barash James at fcidms.com
Tue May 8 13:57:27 CDT 2007


de nada 

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby
Sent: Tuesday, May 08, 2007 1:05 PM
To: dba-sqlserver at databaseadvisors.com
Subject: Re: [dba-SQLServer] SQL Server - Turning comparisons into Booleans

Well James, you da man today!  Right answer.

Thanks,


John W. Colby
Colby Consulting
www.ColbyConsulting.com

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of James
Barash
Sent: Tuesday, May 08, 2007 12:27 PM
To: dba-sqlserver at databaseadvisors.com
Subject: Re: [dba-SQLServer] SQL Server - Turning comparisons into Booleans

John:

If you are trying to return a boolean value you need something like:

(case when [SomeField]<=10 then 1 else 0 end) as MyAlias

James Barash


-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby
Sent: Tuesday, May 08, 2007 11:21 AM
To: 'Access Developers discussion and problem solving';
dba-sqlserver at databaseadvisors.com
Subject: [dba-SQLServer] SQL Server - Turning comparisons into Booleans

In Access you can do something like:
 
MyAlias: [SomeField] <=10
 
Which translates into SQL that looks like:
 
[SomeField]<=10 as MyAlias
 
When I try move that (cut and paste) from Access into SQL Server I get a the
infamous "syntax error somewhere near <"
 
Question 1:  What is wrong with that in SQL Server Question 2: How do I
accomplish this directly in the query builder in SQL Server?
 
John W. Colby
Colby Consulting
www.ColbyConsulting.com
 
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list