How To insert image in database table
CREATE TABLE DBFiles (
id int IDENTITY(1,1) NOT NULL,
fname nvarchar(1000) NOT NULL,
[file] varbinary(max)
)
INSERT INTO DBFiles(fname, [file])
SELECT 'Reporting-Services-2008-enriched-visualization-gadgets.jpg', * FROM OPENROWSET(
BULK N'F:\R.jpg',
SINGLE_BLOB
) rs;
INSERT INTO DBFiles(fname, [file])
SELECT 's.jpg', * FROM OPENROWSET(
BULK N'F:\s.jpg',
SINGLE_BLOB
) rs;
select fname,[file] from DBFiles
select * from DBFiles;
id int IDENTITY(1,1) NOT NULL,
fname nvarchar(1000) NOT NULL,
[file] varbinary(max)
)
INSERT INTO DBFiles(fname, [file])
SELECT 'Reporting-Services-2008-enriched-visualization-gadgets.jpg', * FROM OPENROWSET(
BULK N'F:\R.jpg',
SINGLE_BLOB
) rs;
INSERT INTO DBFiles(fname, [file])
SELECT 's.jpg', * FROM OPENROWSET(
BULK N'F:\s.jpg',
SINGLE_BLOB
) rs;
select fname,[file] from DBFiles
select * from DBFiles;
Comments
Post a Comment