M
Morten Snedker
From a CSV-fil +700,000 records are imported with a simple INSERT INTO.
The import is called by calling an ASPX-page.
I'm using the code below. I'm gathering updates 1000 at a time, and I
then execute the query. This to avoid 700,000 calls to the database.
However, I run into two type of errors:
1.
"There is insufficient system memory to run this query."
This seems fixable with http://support.microsoft.com/kb/912439.
2.
The webpage returns "The request timed out before the page could be
retrieved."
The scriptTimeout is set to one hour, but timeout occurs before this -
why, and how to handle?
Is there a better way of sending the updates to the SQL-server?
....
Server.ScriptTimeout = 3600
....
If CountItems = 1 Then SQL.Append("SET NOCOUNT OFF;")
SQL.AppendFormat("INSERT INTO Cust_GiftToken (GiftTokenID,
GiftTokenValidTo, GiftTokenAmount) VALUES ({0}, '{1}', {2});", id,
validTo.ToString("yyyy-MM-dd"), amount.ToString(enCultureInfo))
If CountItems = 1000 Then
command.CommandText = SQL.ToString
command.ExecuteNonQuery()
command.CommandText = String.Empty
CountItems = 0
SQL.Length = 0
End If
....
End If
Any help is greatly appreciated - thanks in advance!
/Morten
The import is called by calling an ASPX-page.
I'm using the code below. I'm gathering updates 1000 at a time, and I
then execute the query. This to avoid 700,000 calls to the database.
However, I run into two type of errors:
1.
"There is insufficient system memory to run this query."
This seems fixable with http://support.microsoft.com/kb/912439.
2.
The webpage returns "The request timed out before the page could be
retrieved."
The scriptTimeout is set to one hour, but timeout occurs before this -
why, and how to handle?
Is there a better way of sending the updates to the SQL-server?
....
Server.ScriptTimeout = 3600
....
If CountItems = 1 Then SQL.Append("SET NOCOUNT OFF;")
SQL.AppendFormat("INSERT INTO Cust_GiftToken (GiftTokenID,
GiftTokenValidTo, GiftTokenAmount) VALUES ({0}, '{1}', {2});", id,
validTo.ToString("yyyy-MM-dd"), amount.ToString(enCultureInfo))
If CountItems = 1000 Then
command.CommandText = SQL.ToString
command.ExecuteNonQuery()
command.CommandText = String.Empty
CountItems = 0
SQL.Length = 0
End If
....
End If
Any help is greatly appreciated - thanks in advance!
/Morten