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.
| Author |
Topic |
|
rsegecin
Yak Posting Veteran
82 Posts |
Posted - 2007-07-07 : 19:03:35
|
| Hi guys. Is there any function that returns the oposite value? like :declare @myValue bitset @myValue = 1Select function(@myValue)it should return 0 or false.Thank you. |
|
|
chrispy
Posting Yak Master
107 Posts |
Posted - 2007-07-07 : 19:38:24
|
If you are thinking 'invert' I am pretty sure there is nothing like it in T-SQL.I use this :CREATE function dbo.invert ( @i int )returns intasbeginIF @i = 0 SET @i = 1 ELSE SET @i = 0 return @iend |
 |
|
|
rsegecin
Yak Posting Veteran
82 Posts |
Posted - 2007-07-07 : 20:24:20
|
| hmmmm.... thank you chrispy |
 |
|
|
nice123ej
Starting Member
48 Posts |
Posted - 2007-07-08 : 02:28:33
|
| you can use this to select the invert valueselect 1 - @myvalye |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-08 : 04:32:58
|
| CREATE function dbo.invert ( @i bit )returns bitasbeginreturn @i ^ 1endPeter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|