locked
SSRS query for customerid 'contains' text value RRS feed

  • Question

  • I want to filter account names that contain X (so I can include all locations of a customer that start with X). So I want to return records that are XNY, Xboston, XAtlanta and so on).

    Any ideas greatly appreciated.


    Ken Compter

    Saturday, April 12, 2014 1:39 AM

Answers

  • Hi Ken,

    Not sure of your full requirements but if you are after all account names beginning with X for SSRS then here are 2 possible queries.

    FetchXML

    <fetch mapping='logical'>
    	<entity name='account'>
    		<attribute name='accountid'/>
    		<attribute name='accountnumber'/>
    		<attribute name='name'/>
    		<filter type='and'>
    			<condition attribute='name' operator='like' value='X%'/>
    		</filter>
    	</entity>
    </fetch>

    SQL

    select	accountid, accountnumber, name 
    from	FilteredAccount
    where	name like 'X%'


    Eric UNG [Senior Analyst Programmer :: Sydney, Australia]

    • Proposed as answer by Guido PreiteMVP Saturday, April 12, 2014 12:54 PM
    • Marked as answer by kcompter Saturday, April 12, 2014 1:08 PM
    Saturday, April 12, 2014 12:04 PM

All replies

  • Hi Ken,

    Not sure of your full requirements but if you are after all account names beginning with X for SSRS then here are 2 possible queries.

    FetchXML

    <fetch mapping='logical'>
    	<entity name='account'>
    		<attribute name='accountid'/>
    		<attribute name='accountnumber'/>
    		<attribute name='name'/>
    		<filter type='and'>
    			<condition attribute='name' operator='like' value='X%'/>
    		</filter>
    	</entity>
    </fetch>

    SQL

    select	accountid, accountnumber, name 
    from	FilteredAccount
    where	name like 'X%'


    Eric UNG [Senior Analyst Programmer :: Sydney, Australia]

    • Proposed as answer by Guido PreiteMVP Saturday, April 12, 2014 12:54 PM
    • Marked as answer by kcompter Saturday, April 12, 2014 1:08 PM
    Saturday, April 12, 2014 12:04 PM
  • That is it!  Thanks so much.  In case someone else reads this, I first tired with double quotes which failed, but then used single quote which you said to use. 

    Ken Compter

    Saturday, April 12, 2014 1:08 PM