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 |
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2007-04-04 : 11:40:10
|
why this case illigeal or impossible?SELECT @PI = Case WHEN @PI='N' THEN @PI=0 WHEN @PI=N'SENDER' then SELECT PR from tblData WHERE mobile=@S WHEN @PI=N'RECIPIENT' then SELECT PR from tblData WHERE mobile=@R End thnaks i nadvancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-04-04 : 11:44:45
|
[code]SELECT @PI = Case WHEN @PI='N' THEN @PI= 0 WHEN @PI=N'SENDER' then (SELECT PR from tblData WHERE mobile=@S) WHEN @PI=N'RECIPIENT' then (SELECT PR from tblData WHERE mobile=@R) End[/code] KH |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-04-04 : 11:49:21
|
ORSELECT @PI = case when @PI = 'N' then 0 else PR endFROM tblDatawhere @PI = 'N'or mobile = case when @PI = 'SENDER' then @S when @PI = 'RECIPIENT' then @R end KH |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-04 : 12:45:39
|
OrIF @PI = 'Sender' SELECT @PI = PR FROM tblData WHERE Mobile = @SELSE IF @PI = 'Recipient' SELECT @PI = PR FROM tblData WHERE Mobile = @R ELSE IF @PI = 'N' SET @PI = '0' Peter LarssonHelsingborg, Sweden |
 |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2007-04-05 : 03:51:24
|
| thnaks all of u!by the way : is one of the way's it better in performance then the others?ThnakspelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-04-05 : 04:04:12
|
| Set the execution plan and seeMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|