Results 1 to 3 of 3

Thread: Inserting image in Table using SQL Server 2005

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Inserting image in Table using SQL Server 2005

    I have a table named Nomogram.
    I wich to insert an image named td4.png into the column "img1" in the table Nomogram. Why does it not work?
    img1 is defined as varbinary(MAX).

    When I fire this event in the SQL Manager I get an error:
    Code:
    UPDATE    Nomogram
    SET              img1 =
                              (SELECT     *
                                FROM          OPENROWSET(BULK 'C:\td4.png', SINGLE_BLOB) AS ResumeContent)
    WHERE     (bId = 133)
    Does any have a clue?

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Inserting image in Table using SQL Server 2005

    The syntax of Update statement is valid and works fine for me.

    What error are you getting? Possible causes

    Using 'C:\td4.png'. That file must exist on the computer running SQL Server, not the computer where the statement is executed.
    Permissions.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Re: Inserting image in Table using SQL Server 2005

    That could be it!
    It says: You do have have permission to use the bulk load statement.

    My files are located at the SQL Server where I fire the event in a folder named Images (path is Images\td4.png)
    How do I write the command then?
    Like this?
    Code:
    UPDATE    Nomogram
    SET              img1 =
                              (SELECT     *
                                FROM          OPENROWSET(BULK N'td4.png', SINGLE_BLOB) AS ORS)
    WHERE     (bId = 133)

Posting Permissions

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



Click Here to Expand Forum to Full Width