help with query

  • select *

    from customers.dbo.lead

    where leadsource = 'visitor' and Product_Interest = 0

    It worked at first until I tried to do an insert to update the product_interest field to "Big Data" if the leadsource = visitor and the product_interest drop-down field was null.

    Now when I run the query I get this error:

    Syntax error converting the varchar value 'Big Data' to a column of data type int.

    How do I fix this? Help please....

  • Product_Interest is a character column(char, nchar etc.). Are you mixing numeric and character data together? Probably a bad idea.

    Try to put single quotes around the 0.

    select *

    from customers.dbo.lead

    where leadsource = 'visitor' and Product_Interest = '0'

  • littlelisa1111 (1/4/2012)


    select *

    from customers.dbo.lead

    where leadsource = 'visitor' and Product_Interest = 0

    It worked at first until I tried to do an insert to update the product_interest field to "Big Data" if the leadsource = visitor and the product_interest drop-down field was null.

    Now when I run the query I get this error:

    Syntax error converting the varchar value 'Big Data' to a column of data type int.

    How do I fix this? Help please....

    Please post the schema of customers.dbo.lead table

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply