How to change column value based on date (every year)
I am working on a leave management system and I'm using a LocalDB sql server in visual studio 2010 and I need some columns to be updated every year. For example, I have SickLeave column (int), I need this column to be updated with the value (15) in a specific date (every year), the date will be different from one employee to another based on his joining date. I have searched a lot, there is something called scheduled event in mySQL that can do something similar, but it doesn't work for sql server. So anyone has an idea how to do it? Your help will be appreciated. Thanks in advance.
The usual way to schedule things with SQL Server is to use SQL Server Agent. Unfortunately, that won't work for you because it isn't part of LocalDB. Would a computed column work? If not (perhaps because you need to query another table as part of the calculation), what about an insert/update trigger?