Basically I am looking to select the contents of a pdf into a table.
I am using this query:
SELECT *
FROM OPENROWSET(BULK N'\\Server\Share\filename.pdf', SINGLE_BLOB) rs
The query won’t run because my username doesn’t have permissions on that server (nor should it), but I need to be able to authenticate as a different user to execute this query.
It probably won’t be an issue in production as I believe the account running the command will have the proper permissions, but as it is, I would like to be able to “impersonate” this user (I obviously have its credentials) and run the query from my account. Any ideas on how to do this?
Thanks…
You can specify your connection string details in OPENROWSET. See the
{ 'datasource';'user_id';'password' | 'provider_string' }portion of the syntax below.