I need Automatically change

Posted by Jayakumars under Regular Expressions on 7/22/2011 | Points: 10 | Views : 1181 | Status : [Member] [MVP] | Replies : 1
hi
I need how to change this Automatically in sql server

my table structure and Data like this
=====================================
Select * from Tbl_Tesss
=======================
id amount
1 150
2 200
3 300
4 400

My need datawise change i think set constraint and Trigger may be reach this issue

suppose i am using this select query today july 22 i need no change the
amount field but when i will execute this select query every sunday or
after 3 days i will execute this sql query i need update the amount value 150+100 = 250 how to reach this

Mark as Answer if its helpful to you


Responses

Posted by: Sweetyuva on: 7/27/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

use this procedure

create proc Daystatus as
if((select datename(dw, getdate()))='Sunday' or (DATEADD(day,3,LastUpdate)=GETDATE()))
begin
UPDATE tbl set amount=amount+100
update tbl set LastUpdate=getdate()
end

Please add a coloum to your table named LastUpdate

This will help you.

Regards,
Yuvaraj.

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response