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
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 Job to add and remove data automatically.

Author  Topic 

aislancezar
Starting Member

2 Posts

Posted - 2010-11-21 : 23:12:57
Guys,
Good morning everyone!

Good staff, to needing a little help from you.

I have two tables that need to add and remove data automatically.

example:
'm Doing at the moment as follows.
A user makes a donation of a certain sum of money and get a VIP account on my site and will have certain rights for 30 days.
Alas, I have to go manually in sql server 2008 r2 standard and add the data manually and when they complete these 30 days, I have to go back and delete the data.


Example:

Name of the 1st table: user_dir
Columns: user_id, nome_user, nick_user, level;
Actions: suppose there is already a registered user on my site: user_id = '1 ', name_user =' Charles ', nick_user =' Carlito ', level = '1';
So I intend to add the prefix [VIP] nick_user the number 30 and the level of the user eg nick_user = '[VIP] Carlito', level = '30 ';

name of the 2nd table: user_direitos
Columns: user_id, direito_id, direito_nivel;
Action: Add the following data tables: user_id = '1 ', direito_id = '8', direito_nivel = '30 ';


Then, after having passed the 30 days, something that would automatically remove these data from two tables mentioned above, and the user back to being a normal user.

Is it possible? Is there a way, or something that removes the data automatically once the 30 days being completed?

Now, thank you everyone's attention. =)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-21 : 23:32:57
You can schedule a SQL Agent job to do cleanup tasks each day. We purge data on a daily basis.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

aislancezar
Starting Member

2 Posts

Posted - 2010-11-22 : 06:33:40
But you could give me an example of how I would do it, because I do not know much about it. :)

Thank you brother.
Go to Top of Page
   

- Advertisement -