Click here to Skip to main content
12,955,170 members (60,581 online)
Rate this:
Please Sign up or sign in to vote.
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 22:09pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


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,

-Amit Gajjar.
Rate this: bad
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.
snehasish nandy 13-Aug-12 4:24am
can u please give me a rough idea syntactically..??
AlluvialDeposit 13-Aug-12 4:36am
What programming language are you using? Is this an web application, windows form application, c#,, PHP, c++ ??
snehasish nandy 13-Aug-12 5:05am
I am doing it in Classic ASP...
Rate this: bad
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
               check 'Enable' option
Steps tab -> New -> StepName=one      type=trans-SqlScr(TSQL)
                    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'

for more details refer link

Happy Coding!
aarti meswania 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
Top Experts
Last 24hrsThis month
OriginalGriff 6,559
CHill60 3,550
Maciej Los 3,153
ppolymorphe 2,030
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 13 Aug 2012
Copyright © CodeProject, 1999-2017
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