468,140 Members | 1,465 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

DTS Package

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,
Ciarán
Jul 20 '05 #1
2 1347
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" <ch********@hotmail.com> wrote in message
news:7f************************@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,
Ciarán

Jul 20 '05 #2
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" <jb************@hotmail.com> wrote in message news:<%o*******************@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" <ch********@hotmail.com> wrote in message
news:7f************************@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,
Ciarán

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Petterson Mikael | last post: by
10 posts views Thread by datapro01 | last post: by
6 posts views Thread by Page Horton | last post: by
3 posts views Thread by shorti | last post: by
debasisdas
reply views Thread by debasisdas | last post: by
debasisdas
reply views Thread by debasisdas | last post: by
debasisdas
reply views Thread by debasisdas | last post: by
reply views Thread by Steven Samuel Cole | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.