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
TDSSand other malware - prevent and removal tips / thinking
SBS 03 with AD/DC is automaticall re-generated A Host Records
How do I properly setup "Internet Address" and install SSL certificate in SBS 2008?
What are the default site bindings for port 443 on IIS 7 w/ Exchange installed
CRM Backstop
store comma separated multiple numbers in a mysql database field database and query them efficiently
How to highlight row with color in document library in sharepoint 2010?
Maxtor OneTouch 4 Family drive is no longer working
Need a 40" or larger touchscreen computer
Pervasive SQL 9.5 - odbc SELECT Query - DATE = '0000-00-00'