How to import and export binary LOB into and from SQL server
Part 1 - Insert image into database
CREATE TABLE Documents (DocID int, Doc varbinary(max))
INSERT INTO Documents (DocID,Doc)
SELECT 1,* FROM OPENROWSET(BULK N’C:\temp2\pic1.gif’, SINGLE_BLOB) as AXA
select * from dbo.Documents
Part 2 - Documents.fmt
9.0
1
1 SQLBINARY 0 0 “” 1 Doc “”
Part 3 -Export image into gif of jpg file or any other format
–EXEC usp_ExportBinaryFiles 1,’C:\temp\’
–BCP “SELECT Doc FROM TRACES.dbo.Documents [...]
