Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Sir ,

I have a table as below.

CREATE TABLE Employ
(
    
    Name varchar(50) not null,
    Photo varbinary(max) not null,Id int
)


INSERT INTO Employ ( Name, Photo,Id) values
SELECT  'John', BulkColumn
FROM Openrowset( Bulk D:\Arvind@Work\Image\Blue hills.jpg, Single_Blob) as EmployeePicture ,10;


and I want to insert the value in this table But this is give error. Can you help me?

Thanks,
Arvind Kumar Singh
Posted
Updated 24-May-11 22:17pm
v2
Comments
That's Aragon 25-May-11 4:18am    
Update for grammar and better readability. Added code block.

SQL
INSERT INTO Employ ( Name, Photo,Id) values
SELECT  'John', BulkColumn
FROM Openrowset( Bulk D:\Arvind@Work\Image\Blue hills.jpg, Single_Blob) as EmployeePicture ,10;



Enable OpenRowset Support on surface area configuration of sqlserver configuration tool, and then adjust the above query to

SQL
INSERT INTO Employ ( Name, Photo,Id)
SELECT  'John', EmployeePicture.BulkColumn
FROM Openrowset( Bulk D:\Arvind@Work\Image\Blue hills.jpg, Single_Blob) as EmployeePicture ,10;
 
Share this answer
 
Try This, and if still it is giving the error then post the error code.

CREATE TABLE Employees (   
                          Id int,   
                          Name varchar(50) not null, 
                          Photo varbinary(max) not null 
                       )  

INSERT INTO Employees (Id, Name, Photo)  SELECT 10, 'John', BulkColumn  FROM Openrowset( Bulk 'C:\photo.bmp', Single_Blob) as EmployeePicture
 
Share this answer
 

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



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