Knowledge Transfer

Tuesday, February 13, 2007

Sql Server Good Example

if you have to give a flat hike to your EMPloyee using the Following Criteria
Salary b/w 2000 and 3000 then Hike is 200
Salary b/w 3000 and 4000 then Hike is 300
Salary b/w 4000 and 5000 then Hike is 400
IN EMPLOYEE Table

Then The Query is like that

/*************************************************************/
Update EMPLOYEE Set Salary =
Case when Salary between 2000 and 3000 then
Salary = Salary+200
Case when Salary between 3000 and 4000 then
Salary = Salary+300
Case when Salary between 3000 and 4000 then
Salary = Salary+300
End
/************************************************************/

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home