SQL Server Performance

using photos in sql 2005

Discussion in 'Getting Started' started by s26457823, Nov 20, 2007.

  1. s26457823 New Member

    When using photos in a database, which file format is recommended for best performance?
  2. Madhivanan Moderator

    Better store physical path in the table and store images in the server's directory
  3. satya Moderator

    Follow as suggested as you can access the photos from file server using CLR stored procedure to make your life easy.
    If not you can make use of IMAGE data type which is best suited.
    The easiest way to get it in/out of the database is via SQL parameters, whether you prefer to use parameterized queries or stored procedures (which you would still use parameterized queries in the sp). This is because you just need to convert the image/file to a binary array and that is the Value for the parameter (i.e. no need to perform GetChunk, etc.). Download the 101 C#2.0 code samples from MSDN, it contains a sample featuring how to store and retrieve images in and from SQL Server 2005.
  4. FrankKalis Moderator

    [quote user="s26457823"]
    When using photos in a database, which file format is recommended for best performance?
    [/quote]
    You should use the varbinary(Max) data type. The image data type is deprecated and will not be around in a future version. Apart from this, you should understand that there is no such thing as "the best format". SQL Server just stores the binary representation and only delivers this representation. It is up to the client application to interpret this stream.
  5. Madhivanan Moderator

    If you use SQL Server 2005, then it is easy to convert images to binary
    Insert into table(binary_col)
    select
    * FROM OPENROWSET(BULK N'Image_path', SINGLE_BLOB)

Share This Page