Search This Blog

Thursday, September 16, 2010

Inserting an Image into SQL server directly from ManagementStudio(without using frontend app.)

Syntax:

insert into <tablename>(<column-name>) (select * from openrowset(bulk N'<path of image>',single_blob) as <column-name>)


eg:

create table picture (photo image)

insert into picture(photo) (select * from openrowset(bulk N'e:\prash\sunrise.jpg',single_blob) as photo)