locked
Script to save images RRS feed

  • Question

  • Is there a way to save images saved in the hard disk to the database table

    I have a requirement to save it using an insert statement

     

    Monday, December 6, 2010 5:54 AM

Answers

  • Create table TestDoc ( i int primary key, desc varchar(20), textdata image)
    insert into TestDoc (i, desc, textdata)
    (
    select 1, 'desc', *
    from OPENROWSET(BULK N'D:\M.jpg', SINGLE_BLOB) as tempImg
    

    Balmukund Lakhani | Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker
    --------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------------------------------------------------------------------
    My Blog: http://blogs.msdn.com/blakhani
    Team Blog: http://blogs.msdn.com/sqlserverfaq
    • Proposed as answer by Naomi N Monday, December 6, 2010 2:35 PM
    • Marked as answer by KJian_ Monday, December 13, 2010 8:35 AM
    Monday, December 6, 2010 6:03 AM

All replies