ow to store and retrieve pdf,jpg files in SQL Server

  • Hi,

    I need a TSQL to store and retrieve pdf & jpg file into SQL Server tables. Is there a way? This is bit urgent.

    Thanks in advance.

    "More Green More Oxygen !! Plant a tree today"

  • In SQL 2005 you can create a column that is a varbinary(max). your app can then write the entire image into that column. The limit is 2GB per file..

    the better answer usually to is to specify a path and store the path in the DB to the file.

    CEWII

  • Just to add to what Elliott is saying, I guess you will have to convert the image file into bytes array and put it in memory stream and then update that data into your column. So this part of the coding should be done either by your application or a clr stored procedure within your database. Thanks.

    But I would avoid doing this and store only the path (as suggested by Elliott) because if you are doing it using CLR stored procedure, you are swallowing the memory of the sql server. If your file is of size 10MB all this will be loaded into memory (memory stream) while converting it into bytes array. Same case with application process also.(ADO.net or something else)

    ---------------------------------------------------------------------------------

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

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