Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Creating a Boolean Expression in a Column

Author  Topic 

JDrown
Starting Member

10 Posts

Posted - 2005-09-05 : 09:51:41
In Microsoft Access, one can create an expression in a column, i.e.

Trial_Expression: ([Column_X] = [Column_Y])

And Microsoft Access will return a True/False value back. Now how in the world can I compare two columns of the same datatype and have SQL Server return back a True/False value?

I've tried several things, all of which have failed.

I have created a simple User-Defined function, which does work, but there should be a way for T-SQL to handle simple comparasions.


PLEASE HELP!!!


Thanks to all who reply!

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-05 : 09:58:34
Use Case

Select Case when ([Column_X] = [Column_Y]) then 'True' else 'False' End
from yourTable

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -