Insert Image

Hi,

I have column (binary) in KPIimg table, I need to insert image into KPIimg

 Insert [KPIimg] (rate,[img])
 Values (1,(Select  *  from Openrowset( Bulk 'D:\PIC\green.jpg', Single_Blob) as KPI))

I got error:
Msg 8152, Level 16, State 10, Line 1
String or binary data would be truncated.
The statement has been terminated.
samprgAsked:
Who is Participating?
 
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
Did you chekc the length of that VARBINARY column, make sure that it is VARBINARY(MAX)
0
 
Vijaya Reddy Pinnapa ReddyCommented:
Try this one

INSERT INTO [KPIimg] (rate,[img])  
SELECT 1, BulkColumn
FROM Openrowset( Bulk 'D:\PIC\green.jpg', Single_Blob) as KPI
0
 
samprgAuthor Commented:
I get same error, I am useing sql 2012
0
 
samprgAuthor Commented:
Excellent, it was binary(50)
0
All Courses

From novice to tech pro — start learning today.