Using API to run script file
So i want to execute that script file on the other DB...
At first I tried running the script using the Microsoft SQLServer Management Studio, but it failed with a "There is insufficient memory to run this query" error. I also tried with osql, with a .NET SqlCommand and with the SqlDataCompare API and it all failed with the same insufficient memory error.
So my question is, is there a way to run a huge script file using your API without getting the memory error?
Here's a snippet of the code I tried
FileStream fs = File.Open(myScript, FileMode.Open); StreamReader sr = new StreamReader(fs, Encoding.Unicode); BlockExecutor exec = new BlockExecutor(); ExecutionBlock block = new ExecutionBlock(); block.AddBatch(sr.ReadToEnd()); exec.ExecuteBlock(block, strServer, strDatabase); block.Dispose(); sr.Close(); fs.Close();
Any ideas ?
Thanks in advance
p.s.: Building multiple script files or separating the script file is not an option.