Cleardown all rows in a table called stock
Then populate stock with all data from another table called stock1.
I also want to schedule it to run everymorning.
Can anyone help?
Regards,
CiarnHi
You don't need DTS to do this, a standard SQL Agent job can have steps that
run TSQL commands.
Depending on your requirements you can either TRUNCATE the table to remove
all the records or use the DELETE statement. To re-populate the data you can
use an insert statement with a derived table. More information on these
statements are in Books Online.
To create your job you can either do it using Enterprise Manager or by using
the procedures sp_add_job and sp_add_jobstep. Again more details and
examples can be found in Books Online.
I would also recommend that you wrote a stored procedure to handle the
actions required, then you call it from the job step. This will help
maintenance and mean that you can call the same code from other places.
John
"Ciar?n" <chudson007@.hotmail.com> wrote in message
news:7f9b6870.0406230247.cde2c4@.posting.google.com ...
> I want to create a DTS package that will.
> Cleardown all rows in a table called stock
> Then populate stock with all data from another table called stock1.
> I also want to schedule it to run everymorning.
> Can anyone help?
> Regards,
> Ciarn|||If you don't feel comfortable using the SWL agent you can
write a standard SQL script to do this.
something like
delete from stock
insert stock
select *
from stock1
save it on your server, then up a batch file using the osql utility
something like:
osql /E /i c:\script_name.sql
this should then run the sql script by clicking on the batch file and
can then be scheduled to run uing the windows scheduled tasks feature.
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message news:<%ofCc.640$qb5.6064282@.news-text.cableinet.net>...
> Hi
> You don't need DTS to do this, a standard SQL Agent job can have steps that
> run TSQL commands.
> Depending on your requirements you can either TRUNCATE the table to remove
> all the records or use the DELETE statement. To re-populate the data you can
> use an insert statement with a derived table. More information on these
> statements are in Books Online.
> To create your job you can either do it using Enterprise Manager or by using
> the procedures sp_add_job and sp_add_jobstep. Again more details and
> examples can be found in Books Online.
> I would also recommend that you wrote a stored procedure to handle the
> actions required, then you call it from the job step. This will help
> maintenance and mean that you can call the same code from other places.
> John
> "Ciar?n" <chudson007@.hotmail.com> wrote in message
> news:7f9b6870.0406230247.cde2c4@.posting.google.com ...
> > I want to create a DTS package that will.
> > Cleardown all rows in a table called stock
> > Then populate stock with all data from another table called stock1.
> > I also want to schedule it to run everymorning.
> > Can anyone help?
> > Regards,
> > Ciarn
No comments:
Post a Comment