Save an blob via TSQL to Harddisk

  • Hi Folks,

    i use the table Person.address from adventureworks.

    i add a column "Datei" with the datatype varbinary(max).

    Now i add a file like this:

    Update Person.Address

    set datei = (Select * from Openrowset( Bulk 'C:\Test.doc', Single_Blob) as x)

    where addressid = 2

    My question is:

    How can I receive the file from database to save it to localdisk; so that i have the file test.doc...

    Something like select datei from person.address where addressid=1...

    regards

    martin

  • Could you use xp_cmdshell command to copy the file directly to your local machine?

  • slzbi (4/18/2008)


    Hi Folks,

    i use the table Person.address from adventureworks.

    i add a column "Datei" with the datatype varbinary(max).

    Now i add a file like this:

    Update Person.Address

    set datei = (Select * from Openrowset( Bulk 'C:\Test.doc', Single_Blob) as x)

    where addressid = 2

    My question is:

    How can I receive the file from database to save it to localdisk; so that i have the file test.doc...

    Something like select datei from person.address where addressid=1...

    regards

    martin

    Martin,

    This post is a duplicate of this one, which has an answer:

    http://www.sqlservercentral.com/Forums/Topic487470-338-1.aspx

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply