bombdropVB
Programmer
Hi all i wish to transfer some data from SQLServer7 to an excel spreadsheet, when i run the script in Analyzer it works as expected but when i try to use it as an export script in Enterprise manager it doews not work.
This will not nopt transfrer the data can anyone help??
Code:
DECLARE Ace_Handlers CURSOR FOR
SELECT DISTINCT
handler
FROM
claim
OPEN Ace_Handlers
DECLARE @HandlerName varchar(100)
FETCH NEXT FROM
Ace_Handlers
INTO
@HandlerName
WHILE (@@FETCH_STATUS=0 )
BEGIN
SELECT
RIGHT(CAST(Claim.reportdate AS varchar(10)), 2) + RIGHT('00000' + CAST(Claim.gaid AS varchar(5)), 5) 'Our Ref',
Client.Clientshort,
Claim.handler,
Claim.Description,
cd.Reserve
FROM
Claim
INNER JOIN claimdetail cd ON
claim.claimref = cd.claimref
INNER JOIN client ON
claim.clientref = client.clientref
WHERE
CLAIM.HANDLER=@HandlerName
AND
CONVERT(datetime,cd.detaildate,103)
IN
(
SELECT MAX(CONVERT(datetime, claimdetail.detaildate,103))
FROM
claim
INNER JOIN claimdetail ON
claim.claimref = claimdetail.claimref
INNER JOIN client ON
claim.clientref = client.clientref
GROUP by
claimdetail.claimref
HAVING
claimdetail.claimref=cd.claimref
)
AND
cd.reserveflag !='s'
FETCH NEXT FROM
Ace_Handlers
INTO
@HandlerName
END
CLOSE Ace_Handlers
DEALLOCATE Ace_Handlers
This will not nopt transfrer the data can anyone help??