Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2006-09-25 : 09:19:15
hi friends,
i've a table named employee

in this table, , the cl column should be updated by one at the end of the month.please give me query.

here cl is casual leave.

now when ever the month ends, the cl column should be incremented by one.

like for upto this month, i've 6 cl. by the next month it should be incremented by one


table :

eno ename CL
3 vin 5
4 vinu 6



thank you very much

nr
SQLTeam MVY

12543 Posts

Posted - 2006-09-25 : 09:21:44
Why not hold the start date and calculate the value when it's used?

to increment
update tbl set fld = fld + 1
will add one to fld in all rows on the table.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2006-09-25 : 09:26:12
in my table only that perticualr cl column should be updated by one at the last day of the month
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-09-25 : 09:44:03
See the above update statement.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sa
Yak Posting Veteran

77 Posts

Posted - 2006-09-26 : 01:11:22

see the UPDATE STATEMENT that was given to you.

study about JOBS, there you can execute SQL STATEMENTS given a schedule. you might also study how to determine whether a given DATE is the LAST DATE of the currentmonth.
Go to Top of Page
   

- Advertisement -