Store pdf etc in Image Column

  • Hi,

    I want to store a file (probably .pdf or text) in a table. I presume that I should use an Image type for the column but how do I write/ retrieve data from the column? Could somebody give a quick stored proc example? My intention is to then display the file in a vb.net winforms application but that's the next hurdle!

    Thanks.

    Dec.

  • There are several ways to import / upload a file as this is often a FAQ. Below are just of few of KB articles that describe how to do this. You can also use BCP.exe (Bulk Copy Program) DTS, BULK INSERT, TextCopy.exe or BII (Bulk Image Import) just to name a few methods. Note, as PDF and other file formats such as MS Word are binary files, you should store them in a column defined with the IMAGE data type. However, Text (.txt) files can be stored in either a column defined as TEXT or NTEXT. SQL Sever 2000 Books Online (BOL) is the best source of info on these methods.

    258038 HOWTO: Access and Modify SQL Server BLOB Data by Using the ADO Stream Object

    http://support.microsoft.com/?kbid=258038

    309158 HOW TO: Read and Write BLOB Data by Using ADO.NET with C#

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;309158

    308042 HOW TO: Read and Write BLOB Data by Using ADO.NET with VB.NET

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;308042

    326502 HOW TO: Read and Write BLOB Data by Using ADO.NET Through ASP.NET

    http://support.microsoft.com/?id=326502

    Regards,

    John

    SQL Full Text Search Blog

    http://spaces.msn.com/members/jtkane/


    John T. Kane

  • Hi John,

    That looks perfect. I don't know why I couldn't find this myself: I spent about an hour looking for something useful yesterday and couldn't find anything.

    Thanks again.

    Dec.

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

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