SQL Server 2005 stored procedure error
Posted
by
user1670625
on Stack Overflow
See other posts from Stack Overflow
or by user1670625
Published on 2012-10-07T08:44:35Z
Indexed on
2012/10/07
9:37 UTC
Read the original article
Hit count: 236
sql-server-2005
I have created a stored procedure of insert command for employee details in SQL Server 2005 in which one of the parameters is an image for which I have used varbinary
as the datatype in the table..
But when I am adding that parameter in the stored procedure I am getting the following error-
Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query.
Stored procedure:
(
@Employee_ID nvarchar(10)='',
@Password nvarchar(10)='',
@Security_Question nvarchar(50)='',
@Answer nvarchar(50)='',
@First_Name nvarchar(20)='',
@Middle_Name nvarchar(20)='',
@Last_Name nvarchar(20)='',
@Employee_Type nvarchar(15)='',
@Department nvarchar(15)='',
@Photo varbinary(50)=''
)
insert into Registration
(
Employee_ID,
Password,
Security_Question,
Answer,
First_Name,
Middle_Name,
Last_Name,
Employee_Type,
Department,
Photo
)
values
(
@Employee_ID,
@Password,
@Security_Question,
@Answer,
@First_Name,
@Middle_Name,
@Last_Name,
@Employee_Type,
@Department,
@Photo
)
Table structure:
Column Name Data Type Allow Nulls
Employee_ID nvarchar(10) Unchecked
Password nvarchar(10) Checked
Security_Question nvarchar(50) Checked
Answer nvarchar(50) Checked
First_Name nvarchar(20) Checked
Middle_Name nvarchar(20) Checked
Last_Name nvarchar(20) Checked
Employee_Type nvarchar(15) Checked
Department nvarchar(15) Checked
Photo varbinary(50) Checked
I am not getting what to do..can anyone give me some suggestion or solution? Thanks in advance.
© Stack Overflow or respective owner