We help IT Professionals succeed at work.

Insert image into sql 2005 table

Medium Priority
399 Views
Last Modified: 2012-05-06
I am trying to insert an image into a table., from this syntax from the web but it does not seem to work for me.  Keeps gving the error of Incorrect syntax near the keyword BULK.  Don't know if my network address will work either.  I am trying to go over netowrk to my computer to get the image.

 SELECT * FROM OPENROWSET(BULK, '\\ngmnnb-j6ops-a2\C:documents and settings\kevin.deutschman\my documents\my pictures\black1.ico', SINGLE_BLOB)
Comment
Watch Question

Commented:
Hi,

Try this:

SELECT * FROM OPENROWSET(BULK '\\ngmnnb-j6ops-a2\C$\documents and settings\kevin.deutschman\my documents\my pictures\black1.ico', SINGLE_BLOB)

/peter

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
DimitrisSenior Solution Architect

Commented:
remove the ":" from the path
the path is invalid I assume that instead of ":" you should use "\"

Author

Commented:
Hi Pivar,
Still get the Incorrect syntax near the keyword BULK

Commented:
Did you remove the comma after bulk?

Also add an alias
SELECT * FROM OPENROWSET(BULK '\\ngmnnb-j6ops-a2\C$\documents and settings\kevin.deutschman\my documents\my pictures\black1.ico', SINGLE_BLOB) AS icon

Author

Commented:
Correct, i just copied and pasted from here and checked it agian.

Commented:
And you still get syntax error? This statement works fine for me.

Author

Commented:
ah, hold on I am using on my sql 2000 box instead of my sql 2005 box.  I think that makes a differnence

Author

Commented:
It works, but I got an access denied problem now

Commented:
Yes, the user you're logged in with must have permission to the file. How do you log in? SQL server or windows authentication?

Author

Commented:
all windows authentication

Commented:
So, you must give the windows user permission to your iconfile.

Author

Commented:
Roger I am just going to stick in on sql server local drive and pick from there. Thanks for help
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.