How to run a query with large data volume?

Asked

Viewed 1,218 times

3

Is there any way to run a file with a large volume of data without being direct on SQL Server 2014 Management Studio, because I try to open to run and get the following error:

Cannot run script. Insufficient memory to continue implementation of the programme. (mscorlib)

Local do Programa:

   em System.Runtime.InteropServices.Marshal.AllocCoTaskMem(Int32 cb)
   em Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextBuffer.GetText(Int32 startPosition, Int32 chars)
   em Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextBuffer.get_Text()
   em Microsoft.SqlServer.Management.UI.VSIntegration.ShellCodeWindowControl.GetSelectedTextSpan()
   em Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptEditorControl.GetSelectedTextSpan()
   em Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptAndResultsEditorControl.OnExecScript(Object sender, EventArgs a)

1 answer

4


For these cases, the way is to use the command prompt or Powershell and run the script using:

> sqlcmd -S COMPUTADOR\INSTANCIA -i .\MeuScript.sql -d MeuDatabase

Usually I run like this:

> sqlcmd -S .\SQLEXPRESS -i .\MeuScript.sql -d MeuDatabase

Read more about the sqlcmd here.

  • In my case I will run on the server, the script has to be run straight from the server or it can be from another machine ?

  • It can be from another machine. You just need to have access to it.

  • It’s a very valid answer, but since I don’t have access, I had to turn it into an Excel file and import it with the Server 2014 Management Studio wizard....

  • Ah, yes. It works too.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.