SQL Server Performance

Filtering Problems

Discussion in 'SQL Server Reporting Services' started by fisab, Apr 29, 2004.

  1. fisab New Member

    I apologise in advance for the simplicity of the question.

    This is driving me crazy. I'm trying to do the simple task of applying a filter to a table.
    It works fine when I use a field name in both the "expression" and the "value" field, but I get an error every time I use an integer (expression is a smallint) in the "value" field.
    I've tried using :

    Value
    -----
    1
    =1
    '1'
    ='1'

    and in each case I get a 'type' error.


    If I use a string comparison, e.g expression = varchar(50), I dont get an error but dont get results posted back to me :
    example

    Expression Operator
    ---------- --------
    PersonName Like

    Value
    -----
    ="Fred%"
    ='Fred%'
    'Fred%'
    "Fred%"

    Returns nothing.

    Can anyone help me.


    Many thanks in advance for any help


    Steve.

  2. JohnHennesey New Member

    I have heard (and experienced) sometimes you need to explicitly convert values from feilds and literals to the same type.
    So in your case the expression would be:
    cint (Fields!field_name.Value) = cint (1)

    As for your second example, you are trying to use an operator designed for the LIKE statement (%) and using the = operator. This will not work in SQL

    Good luck!
    John

Share This Page