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 |
|
mcbtiger
Starting Member
4 Posts |
Posted - 2010-05-23 : 13:54:35
|
| hello Expert My problem is If/Else condition not work in store procedure i create store procedure i just test If /Else condition it not workif ClientAmount is greater then 500 it insert TotalAmount Add ClientAmount+10 and insert TotalAmount show 510 And if ClientAmount less then 500 it insert TotalAmount show 490 less show i create tableCreate table Profiles(Names varchar(25),ClientAmount int,TotalAmountint) gocreate proc Pro asif exists (select * from profiles where ClientAmount >= 500)beginupdate profiles set Totalamount=ClientAmount+10where Totalamount is Nullendelseif exists(select * from profiles where ClientAmount <=500)beginupdate profiles set totalamount=Client-10where Totalamount is NullendMuhammadali |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-05-23 : 15:09:21
|
| Maybe your table has records where client amount is less and more than 500.If thats the case then always the first update will be executed.PBUH |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2010-05-23 : 15:57:30
|
| So What you want when ClientAmount = 500? |
 |
|
|
|
|
|