| Author |
Topic |
|
dav1djed
Starting Member
10 Posts |
Posted - 2007-04-01 : 08:58:00
|
| I have a problem. I am trying to test complex boolean logic but the only thing I have found is a declare statement, but TSQL does not recognize ABSOLUTE VALUE. Is there a way to write to the database to check something like IF ABS(5) > 0 or or IF ABS(6) + ABS(-8) = 6 + (-8)? |
|
|
dav1djed
Starting Member
10 Posts |
Posted - 2007-04-01 : 09:13:22
|
| This actually may workselect 'True' from [Table name with single row]having ABS(6) > 0 |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-01 : 09:18:52
|
| SELECT 'True' FROM Table1WHERE Col1 < 6 OR Col1 > 6might give you better performance if index is present on Col1.Peter LarssonHelsingborg, Sweden |
 |
|
|
dav1djed
Starting Member
10 Posts |
Posted - 2007-04-01 : 09:24:35
|
quote: Originally posted by Peso SELECT 'True' FROM Table1WHERE Col1 < 6 OR Col1 > 6might give you better performance if index is present on Col1.Peter LarssonHelsingborg, Sweden
Peter thanks but the Boolean logic is actually built in a VARCHAR field which is pulled in dynamically. Sometimes it is >, <, or =. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-01 : 09:34:27
|
| I didn't know that. That is a new piece of information.Do you think it is fair to only tell a part of your problem and having us to guess what you want?Post again what you are trying to achieve, with full sample data and your expected output.Peter LarssonHelsingborg, Sweden |
 |
|
|
pootle_flump
1064 Posts |
Posted - 2007-04-02 : 07:48:34
|
quote: Originally posted by dav1djedPeter thanks but the Boolean logic is actually built in a VARCHAR field which is pulled in dynamically. Sometimes it is >, <, or =.
I believe you are looking at CLR routines then.http://pluralsight.com/blogs/dan/archive/2006/07/27/32597.aspx |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
pootle_flump
1064 Posts |
|
|
Jeff Moden
Aged Yak Warrior
652 Posts |
Posted - 2007-04-03 : 02:07:39
|
| I "absolutely" agree...--Jeff Moden |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-03 : 02:43:32
|
| 1) Two OR's are not allowed.2) IF's are for procedural checks. You should use AND / OR instead.Peter LarssonHelsingborg, Sweden |
 |
|
|
|