Invalid operator for data type. Operator equals modulo, type equals varchar.

Posted on 2006-04-04
Last Modified: 2012-06-27

Please kindly assist how can we resolve the error and what does this means?


Server: Msg 403, Level 16, State 1, Line 9
Invalid operator for data type. Operator equals modulo, type equals varchar.
Question by:DexterJones
    LVL 142

    Assisted Solution

    by:Guy Hengel [angelIII / a3]
    you have somewhere a module operator with at least on of the arguments being of data type varchar.
    without the offending query code we cannot help more
    LVL 75

    Accepted Solution

    you need to convert your field to 'int' before the % opr


    cast (urField as int) % somvalue

    Author Comment

    it was '%' should have been ''%'' for building sql string.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

    737 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