Results 1 to 4 of 4

Thread: Storing binary files in DB

  1. #1
    Join Date
    Jul 2005
    Posts
    8

    Unhappy Storing binary files in DB

    Is there any way to store a binary or image file into a database record / save a binary or image record back into a file using Transact SQL? If yes, would the "image" data type be most suitable?

    (As a background, I am working on a process that deals with incomign emails, and I am using SQL Mail for that purpose. The above is needed to deal with attachments that may come with emails, and which are saved in a physical file on the HDD).

    Thanks a lot in advance...

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    You can save binary file into sql table with writetext, check sql books online for details.

  3. #3
    Join Date
    Jul 2005
    Posts
    8
    Thanks. I'm fine working with the binary / text fields in the DB. The problem I am facing is how to read from a physical file on the disc / how to write to a physical file on the disc using Transact SQL.

  4. #4
    Join Date
    Sep 2002
    Posts
    5,938
    For text file, can try create linked server to the file in sql.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •