---CREATE TABLE dbo.IMAGETABLE
CREATE TABLE dbo.IMAGETABLE (
IMAGETABLEID INT IDENTITY ( 1 , 1 ) PRIMARY KEY,
ImageName VARCHAR(100),
Photo VARBINARY(MAX))
GO
-- SQL Server import image - sql storing images database sql server
INSERT INTO dbo.IMAGETABLE
([ImageName])
VALUES ('XAVIER.JPG')
UPDATE dbo.IMAGETABLE
SET Photo = (SELECT *
FROM OPENROWSET(BULK 'C:\DELL\XAVIER.JPG',
SINGLE_BLOB) AS x)
WHERE [ImageName] = 'XAVIER.JPG'
GO
-- Check table population
SELECT * FROM dbo.IMAGETABLE
GO
No comments:
Post a Comment