Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to create something that runs nightly?

Author  Topic 

Goalie35
Yak Posting Veteran

81 Posts

Posted - 2008-10-21 : 10:05:25
Hello.

This may not be the propper forum for this question but I need to create a query that runs nightly. The query will pull data from multiple locations and store everything into a single table so it's simple to pull for reporting purposes.

Does sql server 2005 have any tools I can use to perform this task?

Thanks.

-Goalie35

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-21 : 10:07:30
Yup. its called sql agent job. You need to create a job through sql agent to execute your query and schedule it to run every night at a convenient time
Go to Top of Page

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-10-21 : 10:16:51
If your goal is simply to have the data in a single table to report on easily it would be easier to either create a View or Stored Procedure which queries the different tables. Then in the report either query the View or call the stored procedure so data appears to come from one location. The advantage of this process is that it will always be up-to-date, no chance of update failing, and has no storage over-head. Additionally this allows you to manipulate data / calculations etc, change column titles etc.
If you still need to import on a schedule, run a SQL query as a scheduled job. The query could either be an UPDATE or a
SELECT * INTO singleTable FROM (select ...... from sourceTable where ......)
Go to Top of Page
   

- Advertisement -