Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the stored procedure as follows :
alter PROCEDURE [dbo].[K2_COPYHUAWEICFR] 
	@FILELOGID BIGINT,
	@FROMCIRCLEID INT,
	@TOCIRCLEID INT,
	@CIRCLE VARCHAR(MAX) = NULL,
	@MSC VARCHAR(MAX) = NULL	
AS
BEGIN
INSERT INTO [K2HUAWEICFRDAILY]
SELECT 
           [FILELOGID]
           ,[COMBINEDMASTERID]
           ,[MSC]=@MSC
           ,[CFRDATE]
           ,[STARTTIME]
           ,[C000CINSS]
           ,[C001NSCNGS]
           ,[C002NSCANF]
           ,[C003NSCANS]
           ,[C004NSCANF]
           ,[C005NSVS]
           ,[C006NSVF]
           ,[C007NSAS]
           ,[C008NSAF]
           ,[C009PMCS]
           ,[C010PMCF]
           ,[C013SEC]
           ,[C014NDILT]
           ,[C015NAILT]
           ,[C016TF]
           ,[C017RTO]
           ,[C018NIILT]
           ,[C019NAILT]
           ,[C020NRILT]
           ,[C021IBS]
           ,[C022CCF]
           ,[C023EMRT]
           ,[C024RBR]
           ,[C025RBA]
           ,[C026CB]
           ,[C027SEF]
           ,[C030STB]
           ,[C031SLB]
           ,[C038ERE]
           ,[C042REC]
           ,[C043CF]
           ,[C044DS]
           ,[C045IDN]
           ,[C056NMB]
           ,[C060CPUCO]
           ,[C061NCRR]
           ,[C062NCCBR]
           ,[C063IFCR]
           ,[C070PDTO]
           ,[C071MPN]
           ,[C073IE]
           ,[C075SE]
           ,[C077CBBOBAWL]
           ,[C078CBBODOC]
           ,[C082NIRFBS]
           ,[C083NIC]
           ,[C085ICUGS]
           ,[C086UCUG]
           ,[C087NSCUG]
           ,[C088BCOCUG]
           ,[C089BCCUG]
           ,[C090CUGSSIV]
           ,[C091ICUGD]
           ,[C093CR]
           ,[C094HOC]
           ,[C095HOF]
           ,[C097TOCLT]
           ,[C098TAE]
           ,[C100CDNE]
           ,[C101NAFC]
           ,[C102CHSBAIC]
           ,[C103CHSBOAC]
           ,[C104CINR]
           ,[C105DNDACWCLS]
           ,[C107MCIB]
           ,[C108CPO]
           ,[C109SNA]
           ,[C110D0WCPLMNUIOA]
           ,[C112CFV]
           ,[C115MEISRIP]
           ,[C116ODTBAOCFMS]
           ,[C117ODTBOAICFMS]
           ,[C118SBOAIC]
           ,[C119SBOAICETCHC]
           ,[C120ODTBAOICECHC]
           ,[C121ODTBATC]
           ,[C122ODTBAOEC]
           ,[C123ODTBOMC]
           ,[C124SROPLMN]
           ,[C125ODTBAONTC]
           ,[C128CFWUR]
           ,[C129UDN]
           ,[C130NRTSTN]
           ,[C131NRTC]
           ,[C132SPT]
           ,[C133DWPLDC]
           ,[C134RU]
           ,[C135CHEDORE]
           ,[C136ODB]
           ,[C137PCRFR]
           ,[C142PS]
           ,[C144NCC]
           ,[C145UDB]
           ,[C146NRFC]
           ,[C147NAFC]
           ,[C148AS]
           ,[C149CR]
           ,[C150NC]
           ,[C151NFC]
           ,[C153RABP]
           ,[C155TE]
           ,[C156IDNF]
           ,[C157FR]
           ,[C158RTSE]
           ,[C159N]
           ,[C162NRA]
           ,[C166NE]
           ,[C169TE]
           ,[C170DC]
           ,[C171AIL]
           ,[C172NROCAA]
           ,[C174PCB]
           ,[C175NRA]
           ,[C177NSSQ]
           ,[C178FANPB]
           ,[C181OCBWCUG]
           ,[C183ICBWCUG]
           ,[C185BCDNP]
           ,[C186NABC]
           ,[C191NSSOOP]
           ,[C193BCDNL]
           ,[C194RTDNL]
           ,[C195AOCSRF]
           ,[C196ACMEO]
           ,[C197FADNL]
           ,[C198OHRBC]
           ,[C201IWFRU]
           ,[C207SOODNL]
           ,[C209ICR]
           ,[C210RIDNE]
           ,[C215TCNCUG]
           ,[C216IT]
           ,[C218NECUG]
           ,[C219ITNS]
           ,[C220ISTOC]
           ,[C221ISTOA]
           ,[C223IM]
           ,[C224NL]
           ,[C225MTNEONL]
           ,[C227IENEONL]
           ,[C230ROTO]
           ,[C231PNE]
           ,[C238MWUP]
           ,[C239PE]
           ,[C254I]
           ,[BHCA]
           ,D.[CREATEDBY]
           ,D.[CREATEDON]
           ,D.[UPDATEDBY]
           ,D.[UPDATEDON]
           ,D.[DELETED]
           ,[CFRMASTERID]=(SELECT TOP 1 ID FROM K2CFRMASTER (NOLOCK) WHERE CIRCLEID=@TOCIRCLEID AND MSC =@MSC)
           ,[CIRCLE]=@CIRCLE
FROM [K2HUAWEICFRDAILY] D (NOLOCK)
INNER JOIN K2CFRMASTER C (NOLOCK)
ON D.CFRMASTERID = C.ID
WHERE C.CIRCLEID = @FROMCIRCLEID
AND C.MSC =@MSC
AND D.FILELOGID= @FILELOGID
END


I am getting error while executing the Stored Procedure.Please refer the tables below:
I have the table as follows:
SQL
CREATE TABLE [dbo].[K2HUAWEICFRDAILY](
    [ID] [bigint] IDENTITY(1,1) NOT NULL,
    [FILELOGID] [bigint] NULL,
    [COMBINEDMASTERID] [int] NULL,
    [MSC] [varchar](max) NULL,
    [CFRDATE] [smalldatetime] NULL,
    [STARTTIME] [varchar](max) NULL,
    [C000CINSS] [int] NULL,
    [C001NSCNGS] [int] NULL,
    [C002NSCANF] [int] NULL,
    [C003NSCANS] [int] NULL,
    [C004NSCANF] [int] NULL,
    [C005NSVS] [int] NULL,
    [C006NSVF] [int] NULL,
    [C007NSAS] [int] NULL,
    [C008NSAF] [int] NULL,
    [C009PMCS] [int] NULL,
    [C010PMCF] [int] NULL,
    [C013SEC] [int] NULL,
    [C014NDILT] [int] NULL,
    [C015NAILT] [int] NULL,
    [C016TF] [int] NULL,
    [C017RTO] [int] NULL,
    [C018NIILT] [int] NULL,
    [C019NAILT] [int] NULL,
    [C020NRILT] [int] NULL,
    [C021IBS] [int] NULL,
    [C022CCF] [int] NULL,
    [C023EMRT] [int] NULL,
    [C024RBR] [int] NULL,
    [C025RBA] [int] NULL,
    [C026CB] [int] NULL,
    [C027SEF] [int] NULL,
    [C030STB] [int] NULL,
    [C031SLB] [int] NULL,
    [C038ERE] [int] NULL,
    [C042REC] [int] NULL,
    [C043CF] [int] NULL,
    [C044DS] [int] NULL,
    [C045IDN] [int] NULL,
    [C056NMB] [int] NULL,
    [C060CPUCO] [int] NULL,
    [C061NCRR] [int] NULL,
    [C062NCCBR] [int] NULL,
    [C063IFCR] [int] NULL,
    [C070PDTO] [int] NULL,
    [C071MPN] [int] NULL,
    [C073IE] [int] NULL,
    [C075SE] [int] NULL,
    [C077CBBOBAWL] [int] NULL,
    [C078CBBODOC] [int] NULL,
    [C082NIRFBS] [int] NULL,
    [C083NIC] [int] NULL,
    [C085ICUGS] [int] NULL,
    [C086UCUG] [int] NULL,
    [C087NSCUG] [int] NULL,
    [C088BCOCUG] [int] NULL,
    [C089BCCUG] [int] NULL,
    [C090CUGSSIV] [int] NULL,
    [C091ICUGD] [int] NULL,
    [C093CR] [int] NULL,
    [C094HOC] [int] NULL,
    [C095HOF] [int] NULL,
    [C097TOCLT] [int] NULL,
    [C098TAE] [int] NULL,
    [C100CDNE] [int] NULL,
    [C101NAFC] [int] NULL,
    [C102CHSBAIC] [int] NULL,
    [C103CHSBOAC] [int] NULL,
    [C104CINR] [int] NULL,
    [C105DNDACWCLS] [int] NULL,
    [C107MCIB] [int] NULL,
    [C108CPO] [int] NULL,
    [C109SNA] [int] NULL,
    [C110D0WCPLMNUIOA] [int] NULL,
    [C112CFV] [int] NULL,
    [C115MEISRIP] [int] NULL,
    [C116ODTBAOCFMS] [int] NULL,
    [C117ODTBOAICFMS] [int] NULL,
    [C118SBOAIC] [int] NULL,
    [C119SBOAICETCHC] [int] NULL,
    [C120ODTBAOICECHC] [int] NULL,
    [C121ODTBATC] [int] NULL,
    [C122ODTBAOEC] [int] NULL,
    [C123ODTBOMC] [int] NULL,
    [C124SROPLMN] [int] NULL,
    [C125ODTBAONTC] [int] NULL,
    [C128CFWUR] [int] NULL,
    [C129UDN] [int] NULL,
    [C130NRTSTN] [int] NULL,
    [C131NRTC] [int] NULL,
    [C132SPT] [int] NULL,
    [C133DWPLDC] [int] NULL,
    [C134RU] [int] NULL,
    [C135CHEDORE] [int] NULL,
    [C136ODB] [int] NULL,
    [C137PCRFR] [int] NULL,
    [C142PS] [int] NULL,
    [C144NCC] [int] NULL,
    [C145UDB] [int] NULL,
    [C146NRFC] [int] NULL,
    [C147NAFC] [int] NULL,
    [C148AS] [int] NULL,
    [C149CR] [int] NULL,
    [C150NC] [int] NULL,
    [C151NFC] [int] NULL,
    [C153RABP] [int] NULL,
    [C155TE] [int] NULL,
    [C156IDNF] [int] NULL,
    [C157FR] [int] NULL,
    [C158RTSE] [int] NULL,
    [C159N] [int] NULL,
    [C162NRA] [int] NULL,
    [C166NE] [int] NULL,
    [C169TE] [int] NULL,
    [C170DC] [int] NULL,
    [C171AIL] [int] NULL,
    [C172NROCAA] [int] NULL,
    [C174PCB] [int] NULL,
    [C175NRA] [int] NULL,
    [C177NSSQ] [int] NULL,
    [C178FANPB] [int] NULL,
    [C181OCBWCUG] [int] NULL,
    [C183ICBWCUG] [int] NULL,
    [C185BCDNP] [int] NULL,
    [C186NABC] [int] NULL,
    [C191NSSOOP] [int] NULL,
    [C193BCDNL] [int] NULL,
    [C194RTDNL] [int] NULL,
    [C195AOCSRF] [int] NULL,
    [C196ACMEO] [int] NULL,
    [C197FADNL] [int] NULL,
    [C198OHRBC] [int] NULL,
    [C201IWFRU] [int] NULL,
    [C207SOODNL] [int] NULL,
    [C209ICR] [int] NULL,
    [C210RIDNE] [int] NULL,
    [C215TCNCUG] [int] NULL,
    [C216IT] [int] NULL,
    [C218NECUG] [int] NULL,
    [C219ITNS] [int] NULL,
    [C220ISTOC] [int] NULL,
    [C221ISTOA] [int] NULL,
    [C223IM] [int] NULL,
    [C224NL] [int] NULL,
    [C225MTNEONL] [int] NULL,
    [C227IENEONL] [int] NULL,
    [C230ROTO] [int] NULL,
    [C231PNE] [int] NULL,
    [C238MWUP] [int] NULL,
    [C239PE] [int] NULL,
    [C254I] [int] NULL,
    [BHCA] [int] NULL,
    [CREATEDBY] [int] NULL,
    [CREATEDON] [datetime] NULL,
    [UPDATEDBY] [int] NULL,
    [UPDATEDON] [datetime] NULL,
    [DELETED] [bit] NULL,
    [CFRMASTERID] [int] NULL,
    [CIRCLE] [varchar](max) NULL,)


I have another table as follows:
CREATE TABLE [dbo].[K2CFRMASTER](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CIRCLEID] [int] NULL,
[CIRCLE] [varchar](max) NULL,
[CITY] [varchar](max) NULL,
[MSC] [varchar](max) NULL,
[CREATEDBY] [int] NULL,
[CREATEDON] [datetime] NULL,
[UPDATEDBY] [int] NULL,
[UPDATEDON] [datetime] NULL,
[DELETED] [bit] NULL,)

I am getting the error:
Msg 257, Level 16, State 3, Procedure K2_COPYHUAWEICFR, Line 18
Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.
Posted
Updated 25-Apr-14 7:09am
v2
Comments
Richard C Bishop 25-Apr-14 13:10pm    
Debug the stored procedure and find where you are attempting to convert an int to a datetime and fix it. Simple as that.

1 solution

You are sending a datetime value and trying to store it in an integer column.
Or else, the oerder of insters in the query has gone wrong.
 
Share this answer
 
Comments
R Harshal 28-Apr-14 4:10am    
Thank you Abhinav S.you are right .
The order of insert in the query was wrong.
Thank you so much for guiding me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900