Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1767
  • Last Modified:

MSSQL OLE DB Provider for SQL Server error '80040e57'

We're seeing an SQL error on our websites after yesterday's migration from WIN2K Server, SQL2000, IIS5 to a new WIN2003 Server Standard with IIS6, MSSQL Server 2005 .

When we first access an asp page, we occasionally get the following SQL error:
Microsoft OLE DB Provider for SQL Server error '80040e57'
String or binary data would be truncated.
/inc/globals.asp, line 355

Line 355 of the "globals" file is: objConn.Execute(SQLQuery)

The Code before that is:

    session("ShopSessionID") = Session.sessionID & "_" & year(date()) & minDigits(month(date()), 2) & minDigits(day(date()), 2) & "_" & minDigits(hour(now()), 2) & minDigits(minute(now()), 2) & minDigits(second(now()), 2) & "_" & minDigits(int(((1000-1) * rnd) + 1), 4)

' Log user info to DB
    SQLQuery = "INSERT INTO tblVisitors (sessionID, visitorIP, visitorBrowser, visitorDateTime, referrer, entryPage, abandonedCart) VALUES ('" & session("ShopSessionID") & "','" & request.servervariables("REMOTE_ADDR") & "','" & prepString(request.serverVariables("HTTP_USER_AGENT")) & "'," & prepDate(now()) & ",'" & prepString(left(session("referrer"), 255)) & "','" & prepString(request.serverVariables("SCRIPT_NAME")) & "', " & prepBoolean("false") & ");"

This worked with no problem on the old server.
3 Solutions
print the contents of SQLQuery....

how did you convert the database to sql 2005?

show us the ddl of the tblvisitors
Check that the values passed to the table are small enough (for want of a better word) to fit in the fields.

For instance if a field is varchar(200) and you try to insert 201 chars you will get that message.
The fact it's on a new server may be coincedence and you might now have tried to insert that many chars before
CWS (haripriya)Commented:
How did u migrate your database?

If you have any auto increment field make sure you have set the seed correctly.  Also check if the primary key field values are same as that of your old database.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now