WordTechinc
Programmer
- Sep 4, 2009
- 38
I am a beginner and need help. I am getting error message
System.Data.SqlClient.SqlException: Error converting data type nvarchar to numeric. at System.Data.SqlClient.SqlCommand.ExecuteReader (Commandbehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
I tried ISNULL(COLUME1,0)but still get same error.
SP code;
INSERT INTO gdtResultDT_MR
(
JobNo, [zip code], [prospective count], [responder count], [reduction], [percresponse],ProsDentCount,
RespDentCount,ProsNonDentCount,RespNonDentCount,ProsRNCount,RespRNCount,RNreduction,RNpercresponse,ProsNonRNCount,RespNonRNCount,NonRNreduction,NonRNpercresponse,
RNind,NonRNind,RNNonRNind,ProsMRCount,RespAllCount,RespHistoryCount,RespNonHistoryCount,MRind,prosORMRCount
)
SELECT @JobNo,
zip_code,
prospective_count,
responder_count,
isnull(reduction,0),
isnull(percresponse,0),
denproscount,
denrespcount,
nondenproscount,
nondenrespcount,
RN_prospective_count,
RN_responder_count,
RNreduction,
RNpercresponse,
NonRN_prospective_count,
NonRN_responder_count,
NonRNreduction,
NonRNpercresponse,
RNind,
NonRNind,
RNNonRNind,
isnull(MR_prospective_count,0),
All_responder_count,
History_Responder_count,
NonHistory_responder_count,
MRind,
ORMR_prospective_count
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),
MR_prospective_count numeric(18, 0),
ALL_responder_count numeric(18, 0),
History_responder_count numeric(18, 0),
NonHistory_responder_count numeric(18, 0),
MRind numeric(18, 0),
ORMR_prospective_count numeric(18, 0)
)myXML
System.Data.SqlClient.SqlException: Error converting data type nvarchar to numeric. at System.Data.SqlClient.SqlCommand.ExecuteReader (Commandbehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
I tried ISNULL(COLUME1,0)but still get same error.
SP code;
INSERT INTO gdtResultDT_MR
(
JobNo, [zip code], [prospective count], [responder count], [reduction], [percresponse],ProsDentCount,
RespDentCount,ProsNonDentCount,RespNonDentCount,ProsRNCount,RespRNCount,RNreduction,RNpercresponse,ProsNonRNCount,RespNonRNCount,NonRNreduction,NonRNpercresponse,
RNind,NonRNind,RNNonRNind,ProsMRCount,RespAllCount,RespHistoryCount,RespNonHistoryCount,MRind,prosORMRCount
)
SELECT @JobNo,
zip_code,
prospective_count,
responder_count,
isnull(reduction,0),
isnull(percresponse,0),
denproscount,
denrespcount,
nondenproscount,
nondenrespcount,
RN_prospective_count,
RN_responder_count,
RNreduction,
RNpercresponse,
NonRN_prospective_count,
NonRN_responder_count,
NonRNreduction,
NonRNpercresponse,
RNind,
NonRNind,
RNNonRNind,
isnull(MR_prospective_count,0),
All_responder_count,
History_Responder_count,
NonHistory_responder_count,
MRind,
ORMR_prospective_count
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),
MR_prospective_count numeric(18, 0),
ALL_responder_count numeric(18, 0),
History_responder_count numeric(18, 0),
NonHistory_responder_count numeric(18, 0),
MRind numeric(18, 0),
ORMR_prospective_count numeric(18, 0)
)myXML