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

Posted on 2007-07-22
Last Modified: 2008-09-13
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.
Question by:lwork
    LVL 50

    Accepted Solution

    print the contents of SQLQuery....

    how did you convert the database to sql 2005?

    show us the ddl of the tblvisitors
    LVL 29

    Assisted Solution

    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
    LVL 16

    Assisted Solution

    by:Haripriya Sathiish
    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

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    Via a live example, show how to shrink a transaction log file down to a reasonable size.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now