Results 1 to 5 of 5

Thread: Sql Error

  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Unanswered: Sql Error

    Hello there, this is my first post here, hope i get good help

    We have a recently migrated from access databse sql server, we had just changed the asp connection codes from access mdb to sql code, and have not touched anything else as of now. We got the error below

    Microsoft OLE DB Provider for SQL Server error '80040e07'

    The sum or average aggregate operation cannot take a nvarchar data type as an argument.

    /common/order_place.asp, line 41



    Below is the coding for that particular lines.

    ******************************
    40.) function QryToVar(pstr,strDName)
    41.) set strDname=server.CreateObject("adodb.recordset")
    42.) strDname.Open
    43.) pstr,objConn,adOpenDynamic,adLockOptimistic,adcmdT ext
    44.) 'Response.Write pstr
    45.) end function
    ******************************


    thanx for any help in advance

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    SQL obviously complains about its inability to "sum" a non numerical field and in the process gives us the final piece of information about the column.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Without posting the SQL involved, I have to make a lot of guesses.

    As Satya pointed out, it appears you are trying to compute the sum of a NVARCHAR column. If your column should contain numbers, you probably need to CAST the column to a numeric type. If your column isn't supposed to contain numbers, you probably shouldn't try to sum it!

    -PatP

  4. #4
    Join Date
    Mar 2004
    Posts
    2

    Smile

    thanx satya & pat

    i have attached the asp file, which queries the db, i did'nt code it.

    can u tell me which are the fields which is been tried to sum, so that i can post the field types.

    thanx in advance
    Attached Files Attached Files

  5. #5
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    tramount and amount
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •