When using bulk insert to populate a table from a .txt
file, what context to access that file does bulk insert
run under? Does it run under the account that SQL Server
runs under or does it run under the authenticated user?
Basically, we have the need to put a small txt file that
will be used for a report by senior management in a
secured directory since it contains confidental info.
Then a report will be generated periodically using the
info in this file and some other info in SQL Server. What
has been proposed is to bulk insert the txt file to a temp
table, run the report and drop the temp table. DBA's
(myself) can't have access to the txt file so if bulk
insert uses the sqlserver acount to access the txt file,
it will not fit our needs since a DBA could bulk insert
this file if they wanted to. However, if the
authenticated user running the bulk insert is used to
access the txt file, then it will work because the txt
file will be in a location accessable by only those who
are allowed to see it.
Thanks for your help,
VanProvided the login exists in the bulkadmin or sysadmin roles, then the Bulk
Insert statement will run under the context of the SQL Server Service
account. To provide a distinction between the windows SQL Server Service
account - which you know - and a separate Windows account having access to
the file, you could use a scheduled DTS package (BulkInsert task). This
would run under the context of the SQL Server agent, to which you could
assign a different account. Provided this account is in the sysadmin role
then it would be ok.
HTH,
Paul Ibison
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment