views:

22

answers:

1

I need to read the image from the specific path. I pass only path as parameter and that image will return by the procedures in image or byte format.

+1  A: 

Take appropriate SQL injection precautions.

EXEC('SELECT image_data
FROM OPENROWSET(
BULK N''' + @Path + ''',
SINGLE_BLOB)
AS ImageSource(image_data);')
Martin Smith
it is not working give me error like this -- Cannot bulk load. The file "C:\1.jpg" does not exist.
KuldipMCA
The file needs to exist **on the server** (or network share visible to the server) and in a place that the SQL Server account has permissions to read.
Martin Smith