Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hi all, I am having one table with these structure
EmpidNameAgeManageridDeptIdSalarySex
I want to update the salary of the Employee like if the Employee is 'M' then increase it 20% and if Femlale('F') then 10%. I am trying like this. But it is not working
update Employee ,Case Sexwhen 'M' then Salary=Salary*1.20when 'F' then Salary=Salary*1.10Else SalaryEnd
Thanks in AdvanceDana
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts
Posted - 2007-11-10 : 00:51:01
[code]Update Employeeset Salery = case Sexwhen 'M' then Salary*1.20when 'F' then Salary*1.10Else SalaryEnd [/code]