开发者

Open Blob fields using Openrowset in SQLSERVER 2008 R2

I need help to read a fileobject from SQLServer2008 R2 using the Openrowset, i can write a File to a Blob column like this:

INSERT INTO myTable(FileName, FileType, Document) 
   SELECT 'Text1.txt' AS FileName, 
      '.txt' AS FileType, 
      * FROM OPENROWSET(BULK N'C:\Text1.txt', SINGLE_BLOB) AS Document;

but how do i read it back and write it to the dis开发者_如何学编程k?

thank you


You can use the bcp utility in conjunction with the queryout argument to save a blob to disk.

bcp "select datei 
     from   Adventureworks.Person.Address 
     WHERE  addressid=1 " 
queryout "c:\TestOut.doc" -T -n -Slocalhost

There are some good examples at the bcp reference page, as well as plenty of command line options.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜