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
 Other SQL Server Topics (2005)
 Automating Query

Author  Topic 

juliaisabel
Starting Member

3 Posts

Posted - 2007-05-16 : 12:12:25
I am looking for the best method of automating an INSERT query in SQL Server 2005

Code:
--------------------------------------------------------------------------------

'INSERT INTO SaltInvWhOpen (StockCode, Warehouse, TrnMonth, TrnYear, OpenBalQty, OpenBalCost)SELECT StockCode, Warehouse, Month(GETDATE()) AS TrnMonth, YEAR(GETDATE()) AS TrnYear, OpenBalQty12, OpenBalQty12 * UnitCost AS Expr1FROM InvWarehouse
--------------------------------------------------------------------------------


In older versions I would have used a DTS package (It's been a long time and I'd have had to use a book to guide me through it), but as that is gone now, I am unsure where to even begin looking.

If someone could assist by giving me the current method, and dare I ask, walk me through it, the help would be much appreciated.

Thank you!

Julia

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-16 : 12:15:35
Do you need to frequently run this Insert? If yes, you can wrap this query in a job and schedule the job to run.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

juliaisabel
Starting Member

3 Posts

Posted - 2007-05-16 : 12:18:51
Yes, I do need it to run on a monthly basis. How do I create a job? Thanks so much for your help!!!!
Go to Top of Page

juliaisabel
Starting Member

3 Posts

Posted - 2007-05-16 : 12:36:07
Never Mind, found it. Thanks for your help!

Julia

Julia I Romero
Go to Top of Page
   

- Advertisement -