missing left parenthesis

Discussion in 'Databases' started by Jamie18, Oct 13, 2009.

  1. #1
    can anyone find the error in this select?
    select * from dbo_contacts c
    WHERE  (first_name IS null 
                     OR trim(first_name) = '')
                    AND (last_name IS null 
                     OR trim(last_name) = '')
                    AND (title IS null 
                     OR trim(title) = '')
                    AND (contact_description IS null 
                     OR trim(cast(contact_description AS VARCHAR)) = '')
                    AND NOT EXISTS
                       (SELECT p.contact_id
                        FROM   dbo_phone p
                        WHERE  (p.llc = 1
                                OR p.wps = 1)
                               AND p.contact_id = c.contact_id
                               AND p.mig_del IS null)
                    AND mig_del IS null;
    Code (markup):
    it claims i'm missing a left parenthesis in between the "contact_description" and "IS" of line 8

    i can't figure it out
     
    Jamie18, Oct 13, 2009 IP
  2. Lavee

    Lavee Well-Known Member

    Messages:
    234
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #2
    You cannot cast to VARCHAR.

    Thanks

    Lavee
     
    Lavee, Oct 16, 2009 IP