How to read/write or copy/paste text file locally using Stored procedure?
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 t开发者_如何转开发he file from network drive and write or paste it locally before running the Bulk Insert?
Thanks
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.
精彩评论