Sorry my question was not clear.
How can l rewrite this without using a cursor.?

l have a conctact database. l have client addresses stored in a database.
What l have a Binary_Checksum on (Addr1, Addr2, Addr3, PCode). l insert the ClientNo
and split the address into three parts Work, Home .... And l first check if its changed
using the binary check sum . If it has l insert the new record and at the same time update
the AddrToDate field to '01/01/2500' which will be the indicator for the latest record.
I do not delete the old record. l keep the history.This is a row by row operation. What l'm looking for is an
example or good articles that l can read and get a good understanding on how l can build in this logic, so l can step through a record set without using a cursor and step through the record set and track address changes.

This is how l'm currently running it. It runs for a very long time

USE Contact

/* Create Binary Checksum Data */
IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE
ID = OBJECT_ID(N'tbl_bcs')AND OBJECTPROPERTY(ID, N'ISUSERTABLE') = 1)
DROP TABLE tbl_bcs

CREATE TABLE tbl_bcs (CIClient bigint,
Addtype smallint,
AddrBcs int)


INSERT INTO tbl_bcs
SELECT CIClient, Addtype, BINARY_CHECKSUM(Addr1, Addr2, Addr3, PCode)
FROM tbaddress1

/* Update Data */
Declare @SAID bigint, @Custcode bigint, @AdrType int,
@PStreetname varchar(50), @PSuburb varchar(50), @PCity varchar(50), @PPostCode varchar(50),
@EStreetname varchar(50), @ESuburb varchar(50), @ECity varchar(50), @EPostCode varchar(50),
@HStreetname varchar(50), @HSuburb varchar(50), @HCity varchar(50), @HPostCode varchar(50),
@Bcs int, @Bcs2 int, @V_Custcode bigint

Declare C_FILE INSENSITIVE Cursor for
Select CAST(IDNO AS bigint), CAST(Custcode AS bigint),
PStreetname, PSuburb, PCity, PPostCode,
EmpStreetname, EmpSuburb, EmpCity, EmpPostCode,
HStreetname, HSuburb, City, HPostCode
from xxx1 where exists
(select 'v' from tbaddress1 where CIClient = Custcode)
order by Custcode for read only

OPEN C_FILE
Fetch next from C_FILE into @SAID, @Custcode,
@PStreetname, @PSuburb, @PCity, @PPostCode,
@EStreetname, @ESuburb, @ECity, @EPostCode,
@HStreetname, @HSuburb, @HCity, @HPostCode
Set @V_Custcode = 99999999

WHILE @@Fetch_status = 0
BEGIN
IF @Custcode != @V_Custcode
BEGIN
If exists (select 'v' from tbaddress1 where CIClient = @Custcode and AddType = 1)
BEGIN
set @Bcs = (Select AddrBcs from tbl_bcs where CIClient = @Custcode and AddType = 1)
Set @Bcs2 = BINARY_CHECKSUM(@PStreetname, @PSuburb, @PCity, @PPostCode)
If @Bcs != @Bcs2
Begin
update tbaddress1 set AddrToDate = convert(datetime,'30/09/2004',103)
where CIClient = @Custcode and Addtype = 1 and
AddrToDate = '01/01/2500'
Insert into tbAddress1
(AddType, Source, ClientKey, ExacClient, MCGClient, CIClient,
Davox, SAID, IACode, IADate, Pamms, PammsDate, PammsExp,
DateReceived, Addr1, Addr2, Addr3, Addr4, PCode,
NixieCode, NixieDate, AddrFromDate, AddrToDate)
Values (1, 500, NULL, NULL, NULL, @Custcode,
NULL, @SAID, NULL, NULL, NULL, NULL, NULL,
convert(datetime,'30/09/2004',103),
@PStreetname, @PSuburb, @PCity, NULL, @PPostCode,
NULL, NULL,
convert(datetime,'30/09/2004',103),
convert(datetime,'01/01/2500',103))
End
END
ELSE
BEGIN
Insert into tbAddress1
(AddType, Source, ClientKey, ExacClient, MCGClient, CIClient,
Davox, SAID, IACode, IADate, Pamms, PammsDate, PammsExp,
DateReceived, Addr1, Addr2, Addr3, Addr4, PCode,
NixieCode, NixieDate, AddrFromDate, AddrToDate)
Values (1, 500, NULL, NULL, NULL, @Custcode,
NULL, @SAID, NULL, NULL, NULL, NULL, NULL,
convert(datetime,'30/09/2004',103),
@PStreetname, @PSuburb, @PCity, NULL, @PPostCode,
NULL, NULL,
convert(datetime,'01/01/1914',103),
convert(datetime,'01/01/2500',103))
END

/* */

If exists (select 'v' from tbaddress1 where CIClient = @Custcode and AddType = 2)
BEGIN
set @Bcs = (Select AddrBcs from tbl_bcs where CIClient = @Custcode and AddType = 2)
Set @Bcs2 = BINARY_CHECKSUM(@HStreetname, @HSuburb, @HCity, @EPostCode)
If @Bcs != @Bcs2
Begin
update tbaddress1 set AddrToDate = convert(datetime,'30/09/2004',103)
where CIClient = @Custcode and Addtype = 2 and
AddrToDate = '01/01/2500'
Insert into tbAddress1
(AddType, Source, ClientKey, ExacClient, MCGClient, CIClient,
Davox, SAID, IACode, IADate, Pamms, PammsDate, PammsExp,
DateReceived, Addr1, Addr2, Addr3, Addr4, PCode,
NixieCode, NixieDate, AddrFromDate, AddrToDate)
Values (2, 500, NULL, NULL, NULL, @Custcode,
NULL, @SAID, NULL, NULL, NULL, NULL, NULL,
convert(datetime,'30/09/2004',103),
@HStreetname, @HSuburb, @HCity, NULL, @HPostCode,
NULL, NULL,
convert(datetime,'30/09/2004',103),
convert(datetime,'01/01/2500',103))
End
END
ELSE
BEGIN
Insert into tbAddress1
(AddType, Source, ClientKey, ExacClient, MCGClient, CIClient,
Davox, SAID, IACode, IADate, Pamms, PammsDate, PammsExp,
DateReceived, Addr1, Addr2, Addr3, Addr4, PCode,
NixieCode, NixieDate, AddrFromDate, AddrToDate)
Values (2, 500, NULL, NULL, NULL, @Custcode,
NULL, @SAID, NULL, NULL, NULL, NULL, NULL,
convert(datetime,'30/09/2004',103),
@HStreetname, @HSuburb, @HCity, NULL, @HPostCode,
NULL, NULL,
convert(datetime,'01/01/1914',103),
convert(datetime,'01/01/2500',103))
END

/* */

If exists (select 'v' from tbaddress1 where CIClient = @Custcode and AddType = 3)
BEGIN
set @Bcs = (Select AddrBcs from tbl_bcs where CIClient = @Custcode and AddType = 3)
Set @Bcs2 = BINARY_CHECKSUM(@EStreetname, @ESuburb, @ECity, @EPostCode)
If @Bcs != @Bcs2
Begin
update tbaddress1 set AddrToDate = convert(datetime,'30/09/2004',103)
where CIClient = @Custcode and Addtype = 3 and
AddrToDate = '01/01/2500'
Insert into tbAddress1
(AddType, Source, ClientKey, ExacClient, MCGClient, CIClient,
Davox, SAID, IACode, IADate, Pamms, PammsDate, PammsExp,
DateReceived, Addr1, Addr2, Addr3, Addr4, PCode,
NixieCode, NixieDate, AddrFromDate, AddrToDate)
Values (3, 500, NULL, NULL, NULL, @Custcode,
NULL, @SAID, NULL, NULL, NULL, NULL, NULL,
convert(datetime,'30/09/2004',103),
@EStreetname, @ESuburb, @ECity, NULL, @EPostCode,
NULL, NULL,
convert(datetime,'30/09/2004',103),
convert(datetime,'01/01/2500',103))
End
END
ELSE
BEGIN
Insert into tbAddress1
(AddType, Source, ClientKey, ExacClient, MCGClient, CIClient,
Davox, SAID, IACode, IADate, Pamms, PammsDate, PammsExp,
DateReceived, Addr1, Addr2, Addr3, Addr4, PCode,
NixieCode, NixieDate, AddrFromDate, AddrToDate)
Values (3, 500, NULL, NULL, NULL, @Custcode,
NULL, @SAID, NULL, NULL, NULL, NULL, NULL,
convert(datetime,'30/09/2004',103),
@EStreetname, @ESuburb, @ECity, NULL, @EPostCode,
NULL, NULL,
convert(datetime,'01/01/1914',103),
convert(datetime,'01/01/2500',103))
END
END
Set @V_Custcode = @Custcode
Fetch next from C_FILE into @SAID, @Custcode,
@PStreetname, @PSuburb, @PCity, @PPostCode,
@EStreetname, @ESuburb, @ECity, @EPostCode,
@HStreetname, @HSuburb, @HCity, @HPostCode
END
CLOSE C_FILE
DEALLOCATE C_FILE