views:

25

answers:

1

Hi

My Stored Procedure is using Bulk Insert Task. As per requirement of Bulk Insert, the text file should be on same server where database is.

Now file is residing on another machine. But database server can access file using shared network drive.

Now question is How my stored procedure can read or copy the file from network drive and write or paste it locally before running the Bulk Insert?

Thanks

+1  A: 

You can enable xp_cmdshell and use it to issue a copy command to the shell.

But then, why would you need that? SQL Server supports bulk insert from remote locations.

GSerg
Hey I tried bulk insert where file is on remote location and passed proper UNC, still does not work for me...
Novice
@Crawling This is usually because the account under which SQL Server runs (local service?) does not have access to network shares. Assign it a different account to run under.
GSerg
@GSerg: So changed the account to Network Service. It worked. Thanks
Novice