Saturday, 30 May 2015

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

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

No comments:

Post a Comment

Please Use Good Leanguage