Microsoft
Software
Hardware
Network
Question : Create a "Batch Number" in SQL Server 2000 for import of sales orders
Hi all.
We currently have a DTS that imports sales order information in 2 tables:
myHeader and myDetails
myHeader: HeaderID, SalesOrderNumber, Customer, Date
myDetail: DetailID, SalesOrderNumber, Item, Quantity
These get imported once an hour. We have to find a way to treat all the sales orders that are imported every hour as a "batch".
So for example:
Let's say at 9am we have the following sales orders to import:
SO-1, SO-2, SO-3, SO-4 and SO-5 these would be considered Batch 1
At 10am we have the following sales orders to import:
SO-A, SO-B and SO-C these would be considered Batch 2
How can I do this in SQL? I'm thinking I would add another field to myHeader called BatchNo and in my DTS right after I import the header information to myHeader then I will do an UPDATE that will look at records where BatchNo isnull and then get the MAX(BatchNo) + 1.
But when I try doing that in my update statement I get the following error: "An aggregate may not appear in the set list of an UPDATE statement."
Below is my update code
Thank you in advance!
1: 2: 3:
UPDATE myHeader SET BatchNumber = MAX(BatchNumber) + 1 WHERE (BatchNumber IS NULL)
Answer : Create a "Batch Number" in SQL Server 2000 for import of sales orders
Click on Send Receive -> Send Receive Groups -> Define Send Receive Groups (at the bottom and may be what jrathi meant). Send Receive groups dialogue box opens. Send receive interval is in there. ... Thinkpads_User
Random Solutions
Windows errors - XP - application DKK C windows system RE shell32Mdll not valid window image
Vmware cluster issues
Cryptor
Outlook inbox refresh problem after upgrading to Exchange 2010
Restoring Intranet Web Site
Blackberry
Java Client Applet - AccessControlException
Outlook 2007 delete cross out message instead of deleting
DBA role
How to test on an Android device