I am getting the error
Error converting datatype nvarchar to int
Code:
ALTER procedure [dbo].[sp_rcdoc]
@regno int,
@appname varchar(50),
@DOI datetime,
@COV varchar(50),
@validtill date,
@imgloc varchar(500),
@ImagNo char(20),
@Purposecode varchar(50),
@FLAG varchar(3)
AS BEGIN
IF NOT EXISTS(SELECT regno FROM tblRCDocuments WHERE regno = @regno)
BEGIN
INSERT INTO tblRCDocuments(regno, appname, DOI, COV, validtill, imgloc, ImagNo, Purposecode, FLAG)
VALUES(@regno, @appname, @DOI, @COV, @validtill, @imgloc, @ImagNo, @Purposecode, @FLAG)
END
Looks like regno is a nvarchar data type in your table and you have passed an int via your your procedure, either use a cast and convert @regno to an nvarchar or change the regno data type to an integer in the table.
DECLARE @regnocast NVARCHAR(15)
SET @regnocast = CAST(@regno AS NVARCHAR)
Then in your SELECT, INSERT and WHERE clauses use @regnocast rather than @regno
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.