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.
| Author |
Topic |
|
alockrem
Starting Member
18 Posts |
Posted - 2007-01-18 : 11:21:12
|
| I need to automate the following function. I know I can do this in .NET but I need to have a DTS package setup so it executes every evening.I have a view that produces a list of sales errors. I want to grab the SaleID from each record and insert a record into a "Current Queue" table.Here is another example of what I'm trying to do...SELECT SaleID FROM vw_SalesErrors- with the results of the SQL statement aboveINSERT INTO tbl_QueueRecords(SaleID, QueueID)VALUES(@SaleID, 14)I'm assuming there is a way to automate this into a single stored procedure or at least a DTS pacakge.Thanks for all of your help. |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-01-18 : 13:27:14
|
| Just create and schedule a job. The query you want, which will just be in a Transact-SQL job step in the job isINSERT INTO tbl_QueueRecords(SaleID, QueueID)SELECT SaleID, 14 FROM vw_SalesErrors |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2007-01-18 : 14:12:29
|
quote: Originally posted by snSQL Just create and schedule a job. The query you want, which will just be in a Transact-SQL job step in the job isINSERT INTO tbl_QueueRecords(SaleID, QueueID)SELECT SaleID, 14 FROM vw_SalesErrors
You may need a check to make sure it is not in the table already:INSERT INTO tbl_QueueRecords (SaleID, QueueID)SELECT a.SaleID, 14FROM vw_SalesErrors awhere a.SaleID not in ( Select b.SaleID from tbl_QueueRecords b ) CODO ERGO SUM |
 |
|
|
|
|
|