Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-server-2005
Hi all
 
i am doing one application where after 30 min(approx.) i have to delete a perticuler users data from the DB.
can any one tell me how to do that..
Posted 12-Aug-12 23:09pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi
 
Here are some useful links,
 
MSDN : SQL Server Job scheduling[^]
 
SQL Agent: A Job Scheduler Framework[^]
 
Or you can also create windows task scheduler and execute your query through windows application(exe) execution with given interval of time.
 
Hope this all information helps you to solve your issue,
 
Thanks
-Amit Gajjar.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you need to actually delete the user, you will have to run a Console App at scheduled time or something.
 
I think you should rethink this and turn it around a bit. You could do this a lot easier. Add a column (DateTime) on your user table. Set that date to DateTime.Now. When you load that user, check if that time is less then 30 minutes ago. If it's not, treat it as deleted.
  Permalink  
Comments
snehasish nandy at 13-Aug-12 4:24am
   
can u please give me a rough idea syntactically..??
AlluvialDeposit at 13-Aug-12 4:36am
   
What programming language are you using? Is this an web application, windows form application, c#, VB.net, PHP, c++ ??
snehasish nandy at 13-Aug-12 5:05am
   
I am doing it in Classic ASP...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

set Sql job
steps are as below...
MsSQL -> ObjExplorer -> SqlServerAgent ->New (if not accessible then start sql agent service)-> Job -> 
 
in this new window,
general tab -> Name=test
               Desc=trial...
               check 'Enable' option
Steps tab -> New -> StepName=one      type=trans-SqlScr(TSQL)
                    Database=Your_DB
                    cmd= Copy paste all your delete queries here.
                    
                    Advance tab -> On success action=Quit the job
 
Schedule tab -> New -> Name=From Morning daily
                       Schedule type= Reccuring
                       check 'Enable' option
                       Daily Frequency => check 'Occure once' at = 10 AM
                                          check 'No End date'
OK
 
for more details refer link
http://www.codeproject.com/Answers/436811/With-out-vs-2010-front-end-i-want-to-delete-multip#answer2
Happy Coding!
Smile | :)
  Permalink  
v2
Comments
aarti meswania at 13-Aug-12 6:44am
   
this is not a code It is a process (sql-job), like we set alarm that way sql-jobs used to set tasks. sql-job will perform configured task when it matches the time you have configured in sql-job. start your sql server -> expand object explorer -> select sqlServerAgent... this way follow above process

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 5,130
1 DamithSL 4,237
2 Maciej Los 3,700
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,846


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 13 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100