May 7, 2008 at 9:39 am
Hi all,
I have a doubt, How to create a schedule for a query to run every day,
do i need to create a DTS/SSIS package
or
I can create a T-SQL task from the maintainance plan and schedule it. which is the right option or is there any other option to do this. Kindly reply me..
Thanks
May 7, 2008 at 9:47 am
Why can't you create a job to run the package and schedule the job to run daily?
May 7, 2008 at 10:43 am
Nicole
The above mentioned way is the preferred way to do this. To create a Job in sql server, right click on the jobs folder under the sql server agent section. The first section to appear will be your general section where you can name the job. when you click on steps, you will see the work add and once you click there, you can put the TSQL code you want to run. Make sure the type is set to TSQL.
Then click on the schedules and set the frequency you want the statement run (Under the new button).
From there you simply save the job and let it run. Although I do recommend that you add something to allow notification on success/failure.
Marvin Dillard
Senior Consultant
Claraview Inc
May 7, 2008 at 10:49 am
Putting the query or script in a T-SQL step of a job has always worked for me in the past. I guess, however, a good question to ask is whether or not there is a benefit to creating an SSIS package with a Execute SQL task containing the query or script?
My predecessor setup numerous scripts to run in DTS packages on our 2000 box which I'm migrating to 2005. Rather than create SSIS packages to replace the DTS packages, I simply copied the script into a job step. We have not gone live with the 2005 server yet so I don't know if it will work the same but I assume it will.
Is there a reason why it would have been setup that way or any benefit? If there isn't any reason or benefit, the T-SQL step in the job is definitely the easiest.
May 7, 2008 at 11:06 am
The only reason to use a DTS or SSIS package is if you're importing or exporting data. The OP didn't indicate that she was doing that so a T-SQL job step would work fine for her. If your scripts aren't importing or exporting, you don't need a package either.
Greg
May 7, 2008 at 12:49 pm
Thanks to every one, it helped me a lot.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply