Link to home
Start Free TrialLog in
Avatar of Mateen
Mateen

asked on

Bulk Insert and Permissions

SQL2K

I am trying

bulk insert security_sql.dbo.share_rate_intermediate  
from '\\mateen\pbapps\security_sql\18052006.txt'  
with ( FielDTERMINATOR = ',' )

The error message is

[Microsoft][ODBC SQL Server Driver][SQL Server]Could not bulk insert because file '\\mateen\pbapps\security_sql\18052006.txt' could not be opened. Operating system error code 5(Access is denied.).

I also tried

bulk insert security_sql.dbo.share_rate_intermediate  
from 'd:\pbapps\security_sql\18052006.txt'  
with ( FielDTERMINATOR = ',' )

the error message is
[Microsoft][ODBC SQL Server Driver][SQL Server]Could not bulk insert because file 'd:\pbapps\security_sql\18052006.txt' could not be opened. Operating system error code 3(The system cannot find the path specified.).

O/s Window 2000
Computer Name:  mateen ( my own machine)
login name : mateen
The file lies in 'd:\pbapps\security_sql\18052006.txt'  

I have shared the folder
D:\pbapps with full control to myself (mateen)

From the Windows Start menu When I run the command
\\mateen\pbapps\security_sql\18052006.txt
the file is opened in notepad.

THEN WHERE IS THE PROBLEM.


Avatar of Aneesh
Aneesh
Flag of Canada image

Are you able to open it from your local machine

try Start->Run -> \\mateen\pbapps\security_sql\18052006.txt
Sorry, I didn't read the complete post
Avatar of Mateen
Mateen

ASKER

Hi aneeshattingal

If I give readonly permission to everyone then the above query works.

I DON'T WANT THAT ANYBODY COULD SEE MY FOLDER.

If you are logged in as 'sa', the operating system security context for BULK INSERT is that of the SQL Server service account.  That account needs permissions to the network resource.  Note that the 'local system' account can't access network resources.

If you change the account, do so from Enterprise Manager (server properties) rather than the services mmc.  Also, rather than mapping a drive, use a UNC path ('\\mateen\pbapps\security_sql').

Avatar of Mateen

ASKER

Hi aneeshattingal

I have got SQL Box installed in my machine. I have administrator rights.
I am running the query from the server [sdmsrv].

<<If you change the account, do so from Enterprise Manager (server properties) rather than the services mmc>>
In Enterprise Manager where is server properties

Avatar of Mateen

ASKER

and in the server properties what will be the tab name
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial