From: Dataman on
Sql Server 2000



I have a table called tblAccountNumRecords that contains an integer field
called "MREmployeeID". This table contains (Variable) 20,000 records each
day and is purged at the end of the day.



I have a table called tblEmployees with a integer field called EmpID and a
text field called "WorkQue". Each employee is assigned a Work Que



Employee 1 has "Work Que 1" assigned to them.

Employee 2 has "Work Que 2" assigned to them.

Employee 2 has "Work Que 3" assigned to them.



10,000 of the 20,000 records in the tblAccountNumRecords table are filtered
and meet the requirements these 3 employees can work with.



Now for the good part:



I need to divide the 10,000 records by the number of employees (3) assigned
a Work Que and update the MREmployeeID in the

tblAccountNumRecords table to the EmpID from the tblEmployees.



For instance Employee 1 gets the first 6666 records

Employee 2 gets the first 6666 records

For instance Employee 3 gets the first 6668 records



I am new to T-SQL and have no idea how to do this.



Thanks



Kurt


From: Michael Coles on
Sounds like the NTILE windowing function might be a decent fit for this
task, although I'm a little unclear on some of the details of your
specifications below.

--
Thanks

Michael Coles
SQL Server MVP
Author, "Expert SQL Server 2008 Encryption"
(http://www.apress.com/book/view/1430224649)
----------------


"Dataman" <kurt(a)dataman.cc> wrote in message
news:v72dnbgYy7SFWFrWnZ2dnUVZ_qOdnZ2d(a)bresnan.com...
> Sql Server 2000
>
>
>
> I have a table called tblAccountNumRecords that contains an integer field
> called "MREmployeeID". This table contains (Variable) 20,000 records each
> day and is purged at the end of the day.
>
>
>
> I have a table called tblEmployees with a integer field called EmpID and a
> text field called "WorkQue". Each employee is assigned a Work Que
>
>
>
> Employee 1 has "Work Que 1" assigned to them.
>
> Employee 2 has "Work Que 2" assigned to them.
>
> Employee 2 has "Work Que 3" assigned to them.
>
>
>
> 10,000 of the 20,000 records in the tblAccountNumRecords table are
> filtered and meet the requirements these 3 employees can work with.
>
>
>
> Now for the good part:
>
>
>
> I need to divide the 10,000 records by the number of employees (3)
> assigned a Work Que and update the MREmployeeID in the
>
> tblAccountNumRecords table to the EmpID from the tblEmployees.
>
>
>
> For instance Employee 1 gets the first 6666 records
>
> Employee 2 gets the first 6666 records
>
> For instance Employee 3 gets the first 6668 records
>
>
>
> I am new to T-SQL and have no idea how to do this.
>
>
>
> Thanks
>
>
>
> Kurt
>
>