Thread: trim function

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    39
    Rep Power
    11

    Question trim function


    i had wrote a query to compare two data from two database. but when compare cos there is spaces after one data in the database. i tried to use the trim function but error occured stated unrecognised s.stud_ans. anyone can help?

    <cfquery name="calculate" datasource="#pppk#">
    SELECT count(*) AS calc_ans
    from pEstudent_ans s INNER JOIN
    #table_name# o ON #Trim(s.stud_ans)#=o.sub_ans
    and s.stud_id= '#stud_id#'
    and s.entry_id ='#entry_id#'
    and o.ques_set ='#ques_set#'
    and s.ques_no= o.ques_no
    </cfquery>
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,243
    Rep Power
    967
    Trim takes a string or a variable. When you do this:

    #Trim(s.stud_ans)#

    CF thinks that you are trying to trim a variable called "s.stud_ans" which I'm guessing does not exist. You can try #trim( 's.stud_ans' )#, but clearly there are no spaces there to trim.

    Try trimming the variables that you ARE passing to the query, like #table_name#, #stud_id#, etc.

IMN logo majestic logo threadwatch logo seochat tools logo