Storing Image file in sql 2005
-
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
-
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
You need to use full pathname of the file, which includes the extension. Jpeg files are binary files. No need to convert.
-
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