question

user-993 (yahoo) avatar image
user-993 (yahoo) asked

Issue while running the bulk insert script(SQL SERVER 2005)

Hi,

        I am facing some issue with running the Bulk Insert script. Here is the detailed information.                     
                    
        I am making an installer which will run on exchange server. This server may have the sql server on another machine on network.                     
                    
        So what I am doing is, in my installer I am creating one Shared Folder and Replace that path in the sql script. and than execute the script.                     
                    
        See below example.                    

BULK

INSERT Accounts

FROM '\MYEXCHANGEMACHINE\DBScripts\Accounts.txt’

WITH

(

-- FIRSTROW = 2,

  FIELDTERMINATOR =  '`~',                    
                    
  ROWTERMINATOR = '\n'                    

)

GO

Here MYEXCHANGEMACHINE is my exchange server machine and DBScripts is my Shared Folder.

        But while I am running this script, I am getting following error.                     
                    
        **Cannot bulk load because the file "\\DT424\DBScripts\Accounts.txt" could not be opened. Operating system error code 5(Access is denied.).**                              
                    
         I searched a lot on google but no luck..                     
                    
        Any idea or any other alternate solution?                    
insert
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Jason Cumberland avatar image
Jason Cumberland answered

You need to make sure that your SQL Server service account has access to the remote share. If you are running the service as localsystem or network service you will have some issues connecting. Network Service can be granted on the share but localsystem is a non-started. Using a domain account is the best option in this case, check the Share and NTFS permissions on your exchange server to add the account.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.