Welcome Guest Search | Active Topics | Members | Log In | Register

SQL Server runs out of memory on INSERT statement Options · View
Dan Guzman
Posted: Friday, October 19, 2007 1:52:59 AM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 19/10/2007 01:52:59
Date: Fri, 19 Oct 2007 06:52:59 -0500

How many rows are you inserting? Consider BCP instead of inserts if you
have a lot of data. Alternatively, break the script into multiple batches
and perhaps use transactions as well.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Mark Allison" <home@markallison.nospam.co.uk> wrote in message
news:74C63577-F944-4130-A53C-69B6E8E450A3@microsoft.com...
> Hi guys
>
> I am trying to run a set of INSERT statements through sqlcmd.exe against a
> SQL Server 2005 SP2 box which has 3.5GB RAM with min. memory set to 512MB
> and max. memory set to 3.0GB.
>
> The command I'm running is:
> sqlcmd.exe -S %1 -E -i MyInsertScript.sql -d %2
>
> MyInsertScript.sql just contains lots of INSERT statements (not wrapped in
> a transaction) - it was actually generated using Red Gate's SQL Packager
> 5.4.
>
> I get an error part way through:
> Msg 701, Level 17, State 123, Server: SERVER1, Line 25719
> There is insufficient system memory to run this query.
>
> Any ideas?
>
> Mark.

Mark Allison
Posted: Friday, October 19, 2007 1:17:04 PM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 19/10/2007 13:17:04
Date: Fri, 19 Oct 2007 12:17:04 +0100

Hi guys

I am trying to run a set of INSERT statements through sqlcmd.exe against a
SQL Server 2005 SP2 box which has 3.5GB RAM with min. memory set to 512MB
and max. memory set to 3.0GB.

The command I'm running is:
sqlcmd.exe -S %1 -E -i MyInsertScript.sql -d %2

MyInsertScript.sql just contains lots of INSERT statements (not wrapped in a
transaction) - it was actually generated using Red Gate's SQL Packager 5.4.

I get an error part way through:
Msg 701, Level 17, State 123, Server: SERVER1, Line 25719
There is insufficient system memory to run this query.

Any ideas?

Mark.

Mark Allison
Posted: Friday, October 19, 2007 3:40:29 PM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 19/10/2007 15:40:29
Date: Fri, 19 Oct 2007 14:40:29 +0100

Thanks Dan, I did the larger inserts using bcp.

"Dan Guzman" <guzmanda@nospam-online.sbcglobal.net> wrote in message
news:3D08C3C2-B57F-4454-9E82-47D7E47FC1B3@microsoft.com...
> How many rows are you inserting? Consider BCP instead of inserts if you
> have a lot of data. Alternatively, break the script into multiple batches
> and perhaps use transactions as well.
>
> --
> Hope this helps.
>
> Dan Guzman
> SQL Server MVP
>
> "Mark Allison" <home@markallison.nospam.co.uk> wrote in message
> news:74C63577-F944-4130-A53C-69B6E8E450A3@microsoft.com...
>> Hi guys
>>
>> I am trying to run a set of INSERT statements through sqlcmd.exe against
>> a SQL Server 2005 SP2 box which has 3.5GB RAM with min. memory set to
>> 512MB and max. memory set to 3.0GB.
>>
>> The command I'm running is:
>> sqlcmd.exe -S %1 -E -i MyInsertScript.sql -d %2
>>
>> MyInsertScript.sql just contains lots of INSERT statements (not wrapped
>> in a transaction) - it was actually generated using Red Gate's SQL
>> Packager 5.4.
>>
>> I get an error part way through:
>> Msg 701, Level 17, State 123, Server: SERVER1, Line 25719
>> There is insufficient system memory to run this query.
>>
>> Any ideas?
>>
>> Mark.
>

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.1 (NET v2.0) - 9/10/2007
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.055 seconds.