Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Delete * from table, -i want this to run one everyday

Posted on 2008-06-18
3
Medium Priority
?
599 Views
Last Modified: 2012-05-05
I want run
Delete * from table,

once a day everyday, and i want to no what is the best way of automating this?
0
Comment
Question by:meteorelec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 2000 total points
ID: 21812585
Create a SQL AGent job and schedule that statement to run when you need it to run.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 21812630
if there are no relationships in this table, replace DELETE *  with a  "TRUNCATE TABLE tableName "  and create a job as Chap mentioned
0
 
LVL 2

Expert Comment

by:AntonyDN
ID: 21812669
Use SQL Server Agent.

Start SQL Server Management Studio (or Query Analyser - It's pretty much the same, so far as I remember) and make sure you can see the Object Explorer (F8 if you can't) and Expand SQL Server Agent, which is at the bottom. Right click Jobs, choose New Job. Give it a name, then click Steps, click New..., name the step, and ensure the Type in the drop down is T-SQL, and the correct database is selected. Type your SQL in to the text box, and click OK.

Then select schedules, and create a new schedule, so it runs when you want.

That's it!

If you can't see SQL Server Agent in the  Object Explorer, you may need to start the service ...
Also, if you want to empty a table each day, it's better to use TRUNCATE TABLE [tablename]

Hope that helps
0

Featured Post

Certified OpenStack Administrator Course

We just refreshed our COA course based on the Newton exam.  With 14 labs, this course goes over the different OpenStack services that are part of the certification: Dashboard, Identity Service, Image Service, Networking, Compute, Object Storage, Block Storage, and Orchestration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question