Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Storing Image file in sql 2005

Storing Image file in sql 2005

Scheduled Pinned Locked Moved Database
databasehelptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 4510968
    wrote on last edited by
    #1

    I tried to store the picture present in the MY Picture location of my system but unable to do so Qurey CREATE TABLE StockGifs (StockGifID int NOT NULL, Gif varbinary(max) NOT NULL) INSERT StockGifs (StockGifID, Gif) SELECT 1, BulkColumn FROM OPENROWSET (BULK 'C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills',SINGLE_BLOB) AS x Error Message :Msg 4860, Level 16, State 1, Line 1 Cannot bulk load. The file "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills" does not exist. Let me know what is the change need to be done If the location alone Can be stored then how to convert a jpeg file to binary file. Thanks in Advance, Praveen Arokiam

    L A 2 Replies Last reply
    0
    • U User 4510968

      I tried to store the picture present in the MY Picture location of my system but unable to do so Qurey CREATE TABLE StockGifs (StockGifID int NOT NULL, Gif varbinary(max) NOT NULL) INSERT StockGifs (StockGifID, Gif) SELECT 1, BulkColumn FROM OPENROWSET (BULK 'C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills',SINGLE_BLOB) AS x Error Message :Msg 4860, Level 16, State 1, Line 1 Cannot bulk load. The file "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills" does not exist. Let me know what is the change need to be done If the location alone Can be stored then how to convert a jpeg file to binary file. Thanks in Advance, Praveen Arokiam

      L Offline
      L Offline
      loyal ginger
      wrote on last edited by
      #2

      You need to use full pathname of the file, which includes the extension. Jpeg files are binary files. No need to convert.

      1 Reply Last reply
      0
      • U User 4510968

        I tried to store the picture present in the MY Picture location of my system but unable to do so Qurey CREATE TABLE StockGifs (StockGifID int NOT NULL, Gif varbinary(max) NOT NULL) INSERT StockGifs (StockGifID, Gif) SELECT 1, BulkColumn FROM OPENROWSET (BULK 'C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills',SINGLE_BLOB) AS x Error Message :Msg 4860, Level 16, State 1, Line 1 Cannot bulk load. The file "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills" does not exist. Let me know what is the change need to be done If the location alone Can be stored then how to convert a jpeg file to binary file. Thanks in Advance, Praveen Arokiam

        A Offline
        A Offline
        Ashfield
        wrote on last edited by
        #3

        Is the picture on your pc or the server? When you run this SQL it executes on the server hosting sql server, so directories are located on there, not your PC

        Bob Ashfield Consultants Ltd Proud to be a Code Project MVP

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups