Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Bulk Insert Error

Author  Topic 

Nitu
Yak Posting Veteran

81 Posts

Posted - 2006-06-02 : 11:10:44
Hi,

I have this statement in my procedure


BULK INSERT Database1.dbo.tmpTable FROM '\\Server1\subfolder1\subfolder2\CSVFile1.csv' WITH ( FIELDTERMINATOR = ',',ROWTERMINATOR = '\n')


I get this error.

Could not bulk insert because file '\\Server1\subfolder1\subfolder2\CSVFile1.csv' could not be opened. Operating system error code 5(Access is denied.).


However, i saw in some posts, to try to open this file from start->Run. Its opening the file without any problems.

I havent used BulkInserts before. So iam quite lost in debugging this error. Can someone help me on this.

Thanks in advance,
Nitu

nr
SQLTeam MVY

12543 Posts

Posted - 2006-06-02 : 11:20:35
try
master..xp_cmdshell 'dir \\Server1\subfolder1\subfolder2\CSVFile1.csv'
and
master..xp_cmdshell 'dir \\Server1\subfolder1\subfolder2\'


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Nitu
Yak Posting Veteran

81 Posts

Posted - 2006-06-02 : 11:29:37
I ran
master..xp_cmdshell 'dir \\Server1\subfolder1\subfolder2\CSVFile1.csv'
on the query analyzer
I got this result set,

output (header)


Access is denied.
NULL


!!!

Thanks for your help,
Nitu
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-06-02 : 11:39:44
That'll be the sql server service account that needs access.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Nitu
Yak Posting Veteran

81 Posts

Posted - 2006-06-02 : 11:45:31
Ok, then i might need to talk to my Sys Admin about that.

Thanks for you help.
--Nitu
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-06-02 : 12:28:04
Why not just have the file placed on the server that you are working on?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

Nitu
Yak Posting Veteran

81 Posts

Posted - 2006-06-02 : 13:48:10
X002548, You are absolutely right. I also thought i will try that and it worked fine.

Go to Top of Page
   

- Advertisement -