开发者

BULK INSERT with Excel from a VARBINARY(MAX) field

开发者 https://www.devze.com 2023-03-14 15:27 出处:网络
BULK INSERT Communication.Message FROM OPENROWSET(\'Microsoft.Jet.OLEDB.4.0\', \'Excel 8.0;Database=C:\\temp\\Messages201101.XLS\', [messages$])
BULK INSERT Communication.Message

FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',

'Excel 8.0;Database=C:\temp\Messages201101.XLS', [messages$])

How do I take the above and instead read Message.XLS from a Varbinary(max) field named FileB开发者_C百科ytes in a table named Attachments.FileContents? I already know how to stage it in the table by various methods-- I just do not know method to use a BULK INSERT from a VarBinary(max) field.


The Jet driver can't open a VARBINARY that contains the bytes of your file. Looking at this MSDN page, the documentation doesn't talk about opening/mounting anything except files. You would have to take the bytes out of FileBytes, write them to a file and then use that file in your OPENROWSET statement.

0

精彩评论

暂无评论...
验证码 换一张
取 消