Hi there, This is probable very simple for most users on here: If I have a table in a database called StockProfiles and I wanted to add one to the StockProfile.Inventory_age if the Stock.Datepur is less or equla to 31/01/2011 What would be the correct t-sql statment and Sql Server Agent job (I assume these would both be the same?) T..
You didn't reveal much about your tables. It seems like you have two tables, Stock and StockProfiles. I'm going to guess there's a primary key in **Stock** called StockID and that there's a foreign key in **StockProfiles**, also called StockID. UPDATE StockProfiles SET Inventory_Age = Inventory_Age + 1 FROM StockProfiles p INNER JOIN Stock s ON p.StockID = s.StockID WHERE Stock.Datepur
So, to rephrase your question ... you want to `UPDATE` your `StockProfile.Inventory_age` `WHERE` the `Stock.DatePur` is `Less than or equal` to '31-Jan-2011'. That translates into a piece of code that would look like UPDATE StockProfile SET Inventory_age = Inventory_age + 1 FROM StockProfile INNER JOIN Stock on StockProfile.ID_Col = Stock.ID_Col WHERE Stock.DatePur