You are here:Home » SQL » Insert Image into database from Folder using T-SQL in SQL Server

Insert Image into database from Folder using T-SQL in SQL Server

For the some project workaround I experienced with insert, some of the images into a database for need, You can do it with OPENROWSET,
CREATE TABLE [dbo].[ImageInsert](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Image] IMAGE -- or VARBINARY(MAX)
) ON [PRIMARY]
GO

INSERT INTO [dbo].[ImageInsert]([Image])
SELECT * FROM
OPENROWSET(BULK N'D:\image\ImageInsert.jpg', SINGLE_BLOB) AS Images
GO