WordTechinc
Programmer
- Sep 4, 2009
- 38
I am getting error: 137 Must declare the variable '@RNCodes'.
Please advide me.
CREATE PROCEDURE [dbo].[INRV2_Insert_gdtResultDT_RN_bkup_20090915_TEST]
(
@RNCodeXMLString ntext,
@XMLString ntext,
@JobNo char(5),
@UiD UNIQUEIDENTIFIER
)
AS
SET NOCOUNT ON
DECLARE @DocId int
DECLARE @BARVALUE INT
EXEC sp_XML_preparedocument @DocId OUTPUT, @XMLString
DELETE FROM gdtResultDT WHERE JobNo=@JobNo
DELETE FROM tbl_ProgressBar_Save where UiD= @UiD
------------------------------------------- RN indicator parm -- 20090915 --------------------------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE @RNDocId int
EXEC sp_XML_preparedocument @RNDocId OUTPUT, @RNCodeXMLString
DECLARE @RNCodes table
(
upZip_Code char(10),
upRNind numeric(18,0),
upNonRNind numeric(18,0),
upRNNonRNind numeric(18,0)
)
INSERT INTO @RNcodes
(upZip_Code, upRNind, upNonRNind, upRNNonRNind)
SELECT
Zip_Code, RNind, NonRNind, RNNonRNind
FROM OpenXML(@RNDocId,'Root/RNCodeTab',2)
WITH
(
Zip_Code char(10),
RNind numeric(18,0),
NonRNind numeric(18,0),
RNNonRNind numeric(18,0)
)
------------------------- end RN indicator --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT INTO gdtResultDT
(
JobNo, [zip code], [prospective count], [responder count], [reduction], [percresponse],ProsDentCount,
RespDentCount,ProsNonDentCount,RespNonDentCount,ProsRNCount,RespRNCount,RNreduction,RNpercresponse,ProsNonRNCount,RespNonRNCount,NonRNreduction,NonRNpercresponse,
RNind,NonRNind,RNNonRNind
)
SELECT @JobNo,
zip_code,
prospective_count,
responder_count,
reduction,
percresponse,
denproscount,
denrespcount,
nondenproscount,
nondenrespcount,
-- RN spilit added suk 20090814 --
RN_prospective_count,
RN_responder_count,
RNreduction,
RNpercresponse,
NonRN_prospective_count,
NonRN_responder_count,
NonRNreduction,
NonRNpercresponse,
RNind,
NonRNind,
RNNonRNind
FROM OpenXML(@DocId,'Root/gdtResultDT',2)
WITH
(
zip_code char(10),
prospective_count numeric(18, 0),
responder_count numeric(18, 0),
reduction real,
percresponse real ,
denproscount numeric(18, 0),
denrespcount numeric(18, 0),
nondenproscount numeric(18, 0),
nondenrespcount numeric(18, 0),
RN_prospective_count numeric(18, 0),
RN_responder_count numeric(18, 0),
RNreduction real,
RNpercresponse real,
NonRN_prospective_count numeric(18, 0),
NonRN_responder_count numeric(18, 0),
NonRNreduction real,
NonRNpercresponse real,
RNind numeric(18,0),
NonRNind numeric(18,0),
RNNonRNind numeric(18,0)
)myXML
--- update RN indicator - gdtResultDt by Jobno& Zip Code -- Error : 137 here ----------------------------------------------------------------------------------------------
UPDATE gdtResultDT set gdtResultDT.RNind = @RNCodes.upRNind
FROM @RNCodes INNER JOIN gdtResultDT ON
gdtResultDT.zip_code = @RNCodes.upZip_Code
WHERE gdtResultDT.JobNo = @JobNo
-- end update RN indicator - gdtResultDT --------------------------------------------------------------------------------------------------------------------------
GO
Please advide me.
CREATE PROCEDURE [dbo].[INRV2_Insert_gdtResultDT_RN_bkup_20090915_TEST]
(
@RNCodeXMLString ntext,
@XMLString ntext,
@JobNo char(5),
@UiD UNIQUEIDENTIFIER
)
AS
SET NOCOUNT ON
DECLARE @DocId int
DECLARE @BARVALUE INT
EXEC sp_XML_preparedocument @DocId OUTPUT, @XMLString
DELETE FROM gdtResultDT WHERE JobNo=@JobNo
DELETE FROM tbl_ProgressBar_Save where UiD= @UiD
------------------------------------------- RN indicator parm -- 20090915 --------------------------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE @RNDocId int
EXEC sp_XML_preparedocument @RNDocId OUTPUT, @RNCodeXMLString
DECLARE @RNCodes table
(
upZip_Code char(10),
upRNind numeric(18,0),
upNonRNind numeric(18,0),
upRNNonRNind numeric(18,0)
)
INSERT INTO @RNcodes
(upZip_Code, upRNind, upNonRNind, upRNNonRNind)
SELECT
Zip_Code, RNind, NonRNind, RNNonRNind
FROM OpenXML(@RNDocId,'Root/RNCodeTab',2)
WITH
(
Zip_Code char(10),
RNind numeric(18,0),
NonRNind numeric(18,0),
RNNonRNind numeric(18,0)
)
------------------------- end RN indicator --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT INTO gdtResultDT
(
JobNo, [zip code], [prospective count], [responder count], [reduction], [percresponse],ProsDentCount,
RespDentCount,ProsNonDentCount,RespNonDentCount,ProsRNCount,RespRNCount,RNreduction,RNpercresponse,ProsNonRNCount,RespNonRNCount,NonRNreduction,NonRNpercresponse,
RNind,NonRNind,RNNonRNind
)
SELECT @JobNo,
zip_code,
prospective_count,
responder_count,
reduction,
percresponse,
denproscount,
denrespcount,
nondenproscount,
nondenrespcount,
-- RN spilit added suk 20090814 --
RN_prospective_count,
RN_responder_count,
RNreduction,
RNpercresponse,
NonRN_prospective_count,
NonRN_responder_count,
NonRNreduction,
NonRNpercresponse,
RNind,
NonRNind,
RNNonRNind
FROM OpenXML(@DocId,'Root/gdtResultDT',2)
WITH
(
zip_code char(10),
prospective_count numeric(18, 0),
responder_count numeric(18, 0),
reduction real,
percresponse real ,
denproscount numeric(18, 0),
denrespcount numeric(18, 0),
nondenproscount numeric(18, 0),
nondenrespcount numeric(18, 0),
RN_prospective_count numeric(18, 0),
RN_responder_count numeric(18, 0),
RNreduction real,
RNpercresponse real,
NonRN_prospective_count numeric(18, 0),
NonRN_responder_count numeric(18, 0),
NonRNreduction real,
NonRNpercresponse real,
RNind numeric(18,0),
NonRNind numeric(18,0),
RNNonRNind numeric(18,0)
)myXML
--- update RN indicator - gdtResultDt by Jobno& Zip Code -- Error : 137 here ----------------------------------------------------------------------------------------------
UPDATE gdtResultDT set gdtResultDT.RNind = @RNCodes.upRNind
FROM @RNCodes INNER JOIN gdtResultDT ON
gdtResultDT.zip_code = @RNCodes.upZip_Code
WHERE gdtResultDT.JobNo = @JobNo
-- end update RN indicator - gdtResultDT --------------------------------------------------------------------------------------------------------------------------
GO