locked
Trying to insert an image RRS feed

  • Question

  • I have a table that I need to insert a different image into each record. How do I do a where clause here

    INSERT INTO dbo.Report_Image_LKP
    SELECT *
    FROM OPENROWSET(BULK 'C:\Documents and Settings\Desktop\IMAGES\LetterHeadLogo.jpg', SINGLE_BLOB)


    ***** WHERE (Report_Image_LKP_ID = 5)


    www.helixpoint.com
    Friday, January 21, 2011 2:25 PM

Answers

All replies

  • Helix,

    Insert statements don't have where clauses (yes, subqueries to grab the data do but those are select statements inside of an insert). It seems that you are looking at doing an UPDATE to an existing row, not inserting a brand new one. Could you give us the table structure and fields - we might be able to help you more.

    -Sean

    • Proposed as answer by Naomi N Friday, January 21, 2011 2:51 PM
    Friday, January 21, 2011 2:31 PM
  • Wow. Brain fart

     

    UPDATE    dbo.Report_Image_LKP
    SET              Image =
                              (SELECT     *
                                FROM          OPENROWSET(BULK 'C:\Documents and Settings\Desktop\IMAGES\LetterHeadLogo.jpg', SINGLE_BLOB) AS derivedtbl_1)
    WHERE     (Report_Image_LKP_ID = 5)


    www.helixpoint.com
    Friday, January 21, 2011 2:36 PM
  • Hi,

    There is a good link which describes how to import image, please see:
    http://www.sqlusa.com/bestpractices/imageimportexport/

    Thanks,
    Ai-Hua Qiu


    Ai-hua Qiu[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Ai-hua Qiu Monday, January 31, 2011 8:17 AM
    Monday, January 24, 2011 8:40 AM
  • http://dimantdatabasesolutions.blogspot.com/2009/05/how-to-uploadmodify-more-than-one-blob.html
    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    • Marked as answer by Ai-hua Qiu Monday, January 31, 2011 8:17 AM
    Monday, January 24, 2011 8:47 AM
    Answerer