> OK; I think you'll need to post the table structure so we can see what
we're
dealing with.
I was assuming that Company_CODE is a column in 'biltest' and that you
wanted to assign invoice numbers to all biltest rows between certain dates
were the Company_CODE is not '9999'.
Exactly which biltest rows are to be updated?
--
Jeff Mason Custom Apps, Inc.
Jeff@c...
Here's the code to create the situation. There will be three invoices
with five items each. Assume the first invoice number to be '00001'
CREATE TABLE [dbo].[Billtest] (
[Company_CODE] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL ,
[BECODE] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[BICNUM] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[BINV] [varchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
) ON [PRIMARY]
GO
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('4444','4444','4441')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('4444','4445','4442')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('4444','4444','4443')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('4444','4445','4444')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('4444','4444','4445')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('5555','4444','4441')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('5555','4445','4442')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('5555','4444','4443')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('5555','4445','4444')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('5555','4444','4445')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('6666','4444','4441')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('6666','4445','4442')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('6666','4444','4443')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('6666','4445','4444')
Insert into Billtest(Company_CODE,BECODE,BICNUM) Values
('6666','4444','4445')