C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Auto Incremet in SQL


Posted Date: 28 Aug 2008      Total Responses: 4

Posted By: Navaneetha Krishnan .P.R       Member Level: Gold     Points: 1


Hi all,

I have a employee table having salary column in it. I would like to increment the salary in a table by the condition if the employee having the salary Rs.10000 then the increment will be 1000 and if it is 20000 then increment is 2000.....etc...


When I add 1000 to the first employee having salary having 10000, then automatically the increment should be done to all other employes.

How to write a query in SQL?


Thanks in Advance.




Responses

Author: venu kumar    28 Aug 2008Member Level: SilverRating:     Points: 0
create trigger on the table with the condition


Author: Ritesh N. Jain    28 Aug 2008Member Level: GoldRating:     Points: 3
In case it's one time batch update,better use simple UPDATE startement rather than going for Trigger,

UPDATE Employee
SET
Salary = Salary * 1.1



Author: http://venkattechnicalblog.blogspot.com/    31 Aug 2008Member Level: DiamondRating:     Points: 2


Yep, an update statement will do this.

Regards,
Venkatesan Prabu .J
http://venkattechnicalblog.blogspot.com/


Author: palla    01 Sep 2008Member Level: SilverRating:     Points: 3
hi

select employeeid,salary=case when salary>10000 then salary=salary+1000
when salary>20000 then salary=salary+2000
else
salary
end
from employee

this is easy way.



Post Reply
You must Sign In to post a response.
Next : Find Nth Max value in SQL
Previous : Triggers
Return to Discussion Forum
Post New Message
Category: SQL Server

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing services

Contact Us    Privacy Policy    Terms Of Use