Insert Picture into SQL Server 2005 Image Field using only SQL

Germstorm picture Germstorm · Jan 6, 2009 · Viewed 168k times · Source

Using SQL Server 2005 and Management Studio how do I insert a picture into an Image type column of a table?

Most importantly how do I verify if it is there?

Answer

Darin Dimitrov picture Darin Dimitrov · Jan 6, 2009
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