При попыткеОткрыть блокированной текстовый файл с SQL Server
BULK INSERT table FROM 'c:\file.txt'
я
Msg 4861, Level 16, State 1, Line 1
Cannot bulk load because the file "c:\file.txt" could not be opened. Operating system error code 32(The process cannot access the file because it is being used by another process.).
ошибку, так как файл находится в лог-файл открыт другим процессом.
Однако с C# я могу открыть файл с System.IO.FileShare.ReadWrite
как:
using (System.IO.FileStream fileStream = new System.IO.FileStream("c:\\file.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite))
{
using (System.IO.StreamReader streamReader = new System.IO.StreamReader(fileStream))
{
file = streamReader.ReadToEnd();
}
}
Есть ли способ, чтобы иметь, что ReadWrite функциональность доля в SQL Server (массовой вставки или любой другой)?
Благодаря
Хорошее обходное решение –
+1. Побей меня! –