Link to home
Start Free TrialLog in
Avatar of thierry91
thierry91

asked on

MS SQL request INSERT with out use convert

my INSERT is :

INSERT INTO [SurfControl_WebFilter].[dbo].[_WhereObjList_A] ([Object_ID],[Attrib_Name],[Type],[Attrib_Val_S],[Attrib_Val_N],[Attrib_Val_B]) VALUES
(
'1, int,'
,'Member, varchar(40),'
,'0, int,','ScoutMonitored\Monitored Sites\www.superu-laiz.com, varchar(250),'
,'NULL, int,'
,'NULL, varbinary(255),'
)



table WebFilter is :

CREATE TABLE [dbo].[_WhereObjList_A](
      [Object_ID] [int] NULL,
      [Attrib_Name] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [Type] [int] NULL,
      [Attrib_Val_S] [varchar](250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
      [Attrib_Val_N] [int] NULL,
      [Attrib_Val_B] [varbinary](255) NULL
) ON [PRIMARY]

When I whant insert I have ERROR :

Msg 257, Level 16, State 3, Line 1
Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query.

I not want use CONVERT.

where is my error in my request INSERT ?
SOLUTION
Avatar of Paul Jackson
Paul Jackson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you are trying to store all varchar values in table.
so need to change the column data type to varchar or nvarchar.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial