Script to save varbinary data to disk

后端 未结 8 1753
无人及你
无人及你 2020-11-28 07:17

I have some varbinary data stored in a table in MS Sql Server 2005. Does anyone have SQL code that takes a query as input (lets say the query guarantees that a single colum

相关标签:
8条回答
  • 2020-11-28 08:15

    You can use BCP, not T-SQL, but works well.

    BCP "SELECT FileContent FROM table WHERE ID = 1" queryout "C:\file.txt" -T
    
    0 讨论(0)
  • 2020-11-28 08:15

    Just an alternative. You can use the freeware Toad for SQL server and save directly from the editor.

    You can go to their website https://www.toadworld.com and get the freeware there or a 30 day trial of the full version. Its under Download and pick Toad for SQL server.

    You do a regular select statement in Toad on the line that has the image you want to save. When you see the results you can click on the byte image column and on the right you see a PDF tab if this is a PDF document or on the left you see a Image tab. When you click the tab you can see the save logo at the bottom to save the image or file.

    0 讨论(0)
提交回复
热议问题