SQL Server 2008运行大型查询 - 内存不足

时间:2011-03-18 19:55:26

标签: sql sql-server-2008 import sql-server-express

我有一个140mb的SQL查询来将数据导入新数据库。我档案>打开查询,然后尝试执行它,但我得到了:

Exception of type'System.outofmemoryexception' was thrown. (mscorlib)

我得到了8gb ram,使用< 3gb,我该怎么办?

   at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
   at System.Text.StringBuilder..ctor(String value, Int32 startIndex, Int32 length, Int32 capacity)
   at System.Runtime.InteropServices.Marshal.PtrToStringUni(IntPtr ptr)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextBuffer.GetText(Int32 startPosition, Int32 chars)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextBuffer.get_Text()
   at Microsoft.SqlServer.Management.UI.VSIntegration.ShellCodeWindowControl.GetSelectedTextSpan()
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptEditorControl.GetSelectedTextSpan()
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptAndResultsEditorControl.OnExecScript(Object sender, EventArgs a)

Microsoft SQL Server Management Studio                      10.50.1600.1
Microsoft Data Access Components (MDAC)                     6.1.7600.16385
Microsoft MSXML                     3.0 6.0 
Microsoft Internet Explorer                     9.0.8112.16421
Microsoft .NET Framework                        2.0.50727.4952
Operating System                        6.1.7600

1 个答案:

答案 0 :(得分:4)

这是Microsoft Connect上报告的已知问题:

http://connect.microsoft.com/SQLServer/feedback/details/269566/sql-server-management-studio-cant-handle-large-files

如果您看一下,您可以看到一些解决方法,例如使用SQL CMD在Notepad ++中执行和编辑。

然而,似乎他们不会解决这个问题。