Binary data

  • I have a table which stores documents (Word, Excel etc.) and pictures as a binary data.

    The problem is : When someone delete the document from DB, is it possible to restore it from DB backup as a document and save as a file.

    Thankyou

  • If you restore the database under another name, retrieve and save the object to disk.

  • Thanks for reply.

    How can I retrieve the document from database if it is in binary format?

  • Thankyou for the link.

    Looks like the code can help me, but I don't know how to run it.

    I've tried to put it in ActiveX but it doesn't work?

    How can I run it?

    Thank you.

  • Sorry did not read the full article.

    A better solution is to use textcopy.exe

    See usable example at http://www.mssqlcity.com/Articles/KnowHow/Textcopy.htm

  • Have you test it?

    It doesn't work for me.

    I've used textcopy.exe utilities.

    Any thoughts?

  • Step 1

    quote:


    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Test]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[Test]

    GO

    CREATE TABLE [dbo].[Test] (

    [A] [int] NOT NULL ,

    [image] NULL ) TEXTIMAGE_ON [PRIMARY]

    GO

    INSERT INTO Test VALUES (1, 0x0)

    Go


    Step 2

    quote:


    -- Load the file

    textcopy /S SERVER /T TEST /C B /W " WHERE A = 1 " /F C:\jnk.ico /I /Z /D DATABASENAME /U SA /P PASSWORD

    -- Save the file

    textcopy /S SERVER /T TEST /C B /W " WHERE A = 1 " /F C:\jnkII.ico /O /Z /D DATABASENAME /U SA /P PASSWORD


    quote:


    Type

    TEXTCOPY /?

    for the commandline parameters


  • I'm sorry but I did not understand the step2.

    Do I need to load textcopy.exe file or create new one?

    And where this file should be saved?

    What this fragment does mean: C:\jnk.ico

  • C:\JNK.ico is the filename of an icon which I have loaded into the database with the program TEXTCOPY.exe

    C:\JNKII.ICO is the filename where the the image was stored, when retieved from the SQL database using TEXTCOPY.exe to retrieve the image.

    TEXTCOPY.exe is in the folder C:\Program Files\Microsoft SQL Server\MSSQL\Binn and is a Microsoft supplied executable.

  • I have the folllowing error message:

    'TEXTCOPY' is not recognized as an internal or external command,operable program or batch file.

  • Open Windows Explorer and search for TEXTCOPY.exe

    If you do not find it on your own pc search the SQL server machine for it.

  • I have this file on default location C:\Program Files\Microsoft SQL Server\MSSQL\Binn, but it does not work and does not give me any messages.

    Can I see the LOG file?

  • Open a command prompt(DOS promnpt) and change your directory to C:\Program Files\Microsoft SQL Server\MSSQL\Binn

    Type

    TEXTCOPY.exe /?

    The program should display the help menu.

  • Thank you very much.

    It is working now.

Viewing 15 posts - 1 through 15 (of 16 total)

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