Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hai,
I am facing the problem at writing the stored procedure..i want to delete multiple tables data for particular Id for every 24 hours with out using front end i.e, visual studio..

i wrote the stored procedure like this :

SQL
delete from Appointment Where UserId='5effd331-3fa4-4ef4-a358-40babc2890c8'

delete from Campaign where ProviderId='5effd331-3fa4-4ef4-a358-40babc2890c8'

delete from Contact where ProviderId='5effd331-3fa4-4ef4-a358-40babc2890c8'

delete from CompanyProduct where ProviderId='5effd331-3fa4-4ef4-a358-40babc2890c8'

delete from CompanyProvider where CreatedUserId='5effd331-3fa4-4ef4-a358-40babc2890c8'


Please help me...


Thank you
Posted

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

Happy Coding!
:)
 
Share this answer
 
Comments
.net333 8-Aug-12 6:18am    
it's working...thanks you so much aarti....
Aarti Meswania 8-Aug-12 6:21am    
most welcome,
glad to help you!
:)
[no name] 13-Aug-12 6:32am    
Hi
The code which u executed for the problem please i want the same thing for my application.please send me in detail
.net333 15-Aug-12 5:02am    
hi,
Click on Microsoft SQL Server 2008 R2 November CTP--->Configuration Tools-->Sql server configuration Manager....If u click on Sql server Configuration Manager you will get a sql server configuration manager window..in that double click on sql server agent...then click on start button...After that follow the below steps in sql server

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'
.net333 8-Aug-12 6:21am    
i get the sql server agent in local server..but i didn't get it in sql remote server..my database is in remote server
Sounds like a job for SQL Server Agent[^]
 
Share this answer
 
Comments
.net333 8-Aug-12 5:50am    
Thank you..but i didn't understood sql server Agent..how can we create A Job...I referred all the sites but i didn't understood
barneyman 8-Aug-12 5:56am    
you read quick then!

Use the management studio (if you haven't got that, install it - connect to your database, expand the SQL Server Agent, right click on Jobs, Add New ... follow steps ...
.net333 8-Aug-12 6:03am    
Thank you
.net333 8-Aug-12 6:28am    
i get the Sql server agent in local sql server..but i didn't get it in Remote sql server..my database is in Remote Server..not in local server...
barneyman 8-Aug-12 6:37am    
you may need to get your admin to enable the service and/or give you access to it

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900