Performance on searching a name field with the like clause

Hi.  We run 2012 std and I suspect we'll be running into challenges as my user has expressed an interest in searching data based on a like clause across a contact name column that is varchar(80).  The like clause is shown below.  The
question is whether or not an index on this column will (if we make one) even be used when a like clause is introduced?  And any other advice the community may offer.  I'll ask my user if they could limit the search to patterns that match starting
in position 1 but suspect they'll say no.  Currently the table has 1.5 million rows , one pk, and is approx 1100 bytes wide if varchars are fully used.
where ltrim(rtrim(e.[ContactName])) like '%' +IsNull(@contactName1,'') + '%'

Hi.  We run 2012 std and I suspect we'll be running into challenges as my user has expressed an interest in searching data based on a like clause across a contact name column that is varchar(80).  The like clause is shown below.  The
question is whether or not an index on this column will (if we make one) even be used when a like clause is introduced?  And any other advice the community may offer.  I'll ask my user if they could limit the search to patterns that match starting
in position 1 but suspect they'll say no.  Currently the table has 1.5 million rows , one pk, and is approx 1100 bytes wide if varchars are fully used.
where ltrim(rtrim(e.[ContactName])) like '%' +IsNull(@contactName1,'') + '%'
Hi db042190,
>> The question is whether or not an index on this column will (if we make one) even be used when a like clause is introduced?
A simple index use an exact value in order to compare it (it orer the tree according to the value). For most cases it will not be a good solution for filtering by "like" (in some cases it can help you use "index scan", but it will not
be able to use "index seek"). There are several options that can help in this issue dapending on your interface and the way you use the data:
(1) Full Text Index as Olaf mentioned
(2) Another option, which is very useful in some cases, based on using an external table, which store list of searching words (if the user try a new search then you can scan the original table, which this is one-time-job for each new word). This is actually
work on the same idea of using FTS, but it is more flexible and give you direct control if you need to use word searching and not phrase/free-text searching. This table is indexed and the search is done on this table, and not the original table. Those two
tables have relations many-to-many, and you use a simple JOIN to get the results 
>> limit the search to patterns
This can be a game changer!
There is a simple solution that might help you in this case which is very useful! you can create a computed column that store the value according to your patterns, and then create index on that
column. For example if the your pattern is filter by "starting with 10 specific char" then you can use simple LEFT function like in this code:
CREATE TABLE t (LongText nvarchar(MAX), MyPatSearch as convert(nvarchar(10),LEFT(LongText,10)));
GO
CREATE NONCLUSTERED INDEX IX_MyPatSearch ON t (MyPatSearch);
GO
* using computed column with string like in this example, you have to use CONVERT since Data type is requirements for index computed column.
  Ronen Ariely
 [Personal Site]    [Blog]    [Facebook]

Similar Messages

  • Predefault "User Name" field with Login Name

    Hi,
    Predefault in "LS Medical User Verification" BC does not work. I tried to do the following but all did not work:
    * Put a predefault value in the "User Name" field, System: Creator
    * Create a calc field "SCR Login", calc value: LoginName (). Set predefault of "User Name" field, Field: 'SCR Login"
    * Expose "SCR Login" in the applet. Field is blank in UI.
    We are using the vanilla "LS Medical User Verification Applet" for user verification and we want to predefault the User Name field with the current user logged in. How can I achieve this?
    Thanks,
    Jasmin

    Hi,
    I believe Predefault/Postdefault will only work with NewRecord even and since the User Verification Popup Applet does not go to that event on load that is why it does not work.
    Since the client wanted to default the user name with the current user logged in, we just removed the User name field from the popup applet and pass the TheApplication().LoginName() to the Authentication Business Service.
    Thanks,
    Jasmin

  • XSQL Using bind params with sql LIKE clause

    I am unable to use a bind-param with the LIKE clause in a SELECT statement.
    eg call .../temp.xsql?name=N
    XSQL query is this:
    <xsql:query max-rows="-1" bind-params="name">
    SELECT last_name
    FROM emp
    WHERE last_name LIKE '?%'
    </xsql:query>
    I have tried a few combinations so far with no success eg:
    WHERE last_name LIKE '{@name}%'
    WHERE last_name LIKE ?||%
    Any ideas?

    I highly recommend using XSQL's real bind variable feature wherever you can. You can read about it in the XSQL Online Documentation (Search for the "Using Bind Variables" section).
    Using this feature is more performant and more secure than using textual substitution variables.
    Here's what your page looks like using textual substitution:
    <page connection="UTD4" xmlns:xsql="urn:oracle-xsql">
      <xsql:query null-indicator="yes" >
        SELECT * FROM TC_HL7_SEG WHERE SEGMENT_CODE LIKE '{@code}%'
      </xsql:query>
    </page> .
    And here's what it would look like using real bind variables:
    <page connection="UTD4" xmlns:xsql="urn:oracle-xsql">
      <xsql:query null-indicator="yes" bind-params="code">
        SELECT * FROM TC_HL7_SEG WHERE SEGMENT_CODE LIKE ?||'%'
      </xsql:query>
    </page> .
    Using real bind variables allows the database to avoid reparsing the SQL statement everytime, which improves performance.
    Steve Muench
    JDeveloper/BC4J Development Team
    Author, Building Oracle XML Applications

  • How can I have two fields with the same name if it makes sense?

    Hello, folks :)
    I have a pretty hard time figuring out how I can have two text fields with the same binding name.
    The whole problem is that when I need two fields with the same binding name they are still differnent coz they have the same name but differnt indices.
    I should make a form filled at runtime by merging a pdf form file and an fdf file data file. And I have no choice to do it differently. And my form file needs some data like customerName, companyName twice in one form. But there's only one possible buinding name indexed zero.
    How can I create a field with absolutely the same name or is it just impossible due to possible name conflicts? And is there a workaround to this problem? I just need one piece of data repeated in different places.
    Thanks for your replies :)
    P.S. if u think that the problem is not clear enough let me know. I'll supply you with more details. But the general process can not be changed.
    One pdf should be mergred with an fdf with as the result of their merge a new filled and flattened form. I have no control over fdfs their are generated by Oracle and I can not fill the form using XML files coz this process should be integrated in a working application.

    I just thought about a really ugly workaround with a server-side script adding values to fdf files but it's a bit of work and tests and personally i think it's a bad idea :-(

  • The field "GLTPC" is unknown, but there is a field with the similar name*

    Hi all
    When i am running the report painter reports in SAP
    i am getting this error .
    Syntax error in program    SAPFGRWG
    in include                  FGRWGE60
    in line                      19
    Last changed by            SAP
    Author                     SAP
    The field "GLTPC" is unknown, but there is a field with the similar name
    "GLTPC".*
    Please help me whenever
    Regards,
    suchithra
    Edited by: Rob Burbank on May 22, 2009 9:00 AM

    Hi All
    All 8A group Report painter reports i.e GLPCt table Reports are not executed properly
    Can you please help me out
    Regards,
    suchithra

  • Is it possible to search for multiple folders with the same name and...

    Is it possible to search for multiple folders with the same name and then select them all and change the permissions on just those folders .i.e. Search for the budget folders in all client folders and lock them down to just the project managers. Without having to go to each folder and apply the permissions.

    user11919409 wrote:
    Is it possible to create a Clone database with the same name of source db using RMAN ...
    yes
    >
    DB version is 11.2.0.2
    Is it possible to clone a 11.2.0.2 database to 11.2.0.3 home location directly on a new server . If it starts in a upgrade mode , it is ok ....yes
    Handle:     user11919409
    Status Level:     Newbie (10)
    Registered:     Dec 7, 2009
    Total Posts:     102
    Total Questions:     28 (22 unresolved)
    why do you waste time here when you rarely get any answers to your questions?

  • Lsmw error - no fields with the same name

    Dear Experts,
    I am trying to upload master data through LSMW through Standard Batch/Direct Input but when i am executing the step READ DATA it is throwing me error as
    File 'C:\Documents and Settings\Guest\Desktop\DMS.TXT' and source structure 'ZEQUI_STRUTURE' have no fields with the same name.
    Even though i cheked my flat file in notepad i used the following field for it
    AEDAT
    EQTYP
    SHTXT
    EQART
    GROES
    ERDAT
    ANSDT
    ANSWT
    WAERS
    HERST
    HERLD
    TYPBZ
    BAUJJ
    BAUMM
    SERGE
    SWERK
    STORT
    BEBER
    GEWRK
    ABCKZ
    EQFNR
    BUKRS
    ANLNR
    KOSTL
    IWERK
    INGRP
    TPLNR
    HEQUI
    Regards,
    Rip.
    Edited by: Julius Bussche on Jan 20, 2009 11:04 AM
    Please use meaningfull subject titles

    Hi Ripel,
    When you are assinging a file if it has field names in first row then select "Field names at Start of file", if not names then uncheck the box at "File Structure".
    If fields are using, then check the tabulator in file and Uncheck the "Field order matches Source structure Definition."
    Regards,
    Sunil
    Edited by: Sunil Reddy Sibbala on Jan 20, 2009 11:10 AM

  • How associating an XMLSchema to an XMLType Field with the database model ?

    How can I precise the XMLSchema to an XMLType Field with the database model ?
    I know how to do it in a SQL Syntax :
    CREATE TABLE xwarehouses (
    warehouse_id NUMBER,
    warehouse_spec XMLTYPE)
    XMLTYPE warehouse_spec STORE AS OBJECT RELATIONAL
    XMLSCHEMA "http://www.oracle.com/xwarehouses.xsd"
    ELEMENT "Warehouse";
    , but we have decided to generate the script with the Jdeveloper database modeler tools, and we don't how to precise this with using this tools ?
    Anyone could help me ?

    I'm not sure that it answers your question but under the tools menu there is an option called register schema with XDB.

  • Mapping the CMP Fields with the Database Table using Websphere???

    Hi,
    How to Map the CMP Fields with the Database Table using Websphere
    thru ejb.jar.xml???
    Thanks,
    JavaCrazyLover

    Hi,
    How to Map the CMP Fields with the Database Table using Websphere
    thru ejb.jar.xml???
    Thanks,
    JavaCrazyLover

  • Dreamweaver CC crashes when moving a DIV field with the keyboard arrows.

    I'm really fond of the new Dreamweaver CC, but on some occasions, it crashes when moving a DIV field with the keyboard arrows, for example, to move it two or three pixels.
    This is happening on a recent pc (i5 / 16Gb ram / Intel SSD / Bootcamped Windows 8 x64)
    F12 is also really slow when publishing via Chrome. Firefox or Internet Explorer is faster.
    Is there a fix for these issues?
    Thanks,
    D

    Apart from the FluidGrid Layouts feature, DW is not a click and drag app like Photoshop or Muse.   You should be using the CSS panels to align elements with floats, margins and padding.
    Keep Chrome open and refresh browser (F5).
    Nancy O.

  • How do I search for a song with the name I typed on my iPhone?

    I run into this a lot and it is extremely frustrating. I want to find a song like "Menuetti", but the search results end up with hundreds of variations of "Menuetto". Even though I know Menuetti is there somewhere, I can't find the song I am looking for because there is so much garbage returned. Is there any way to get the iTunes store to return the few songs with the name I asked for rather than the hundreds with the name I did not?

    You can choose what it searches and where

  • Custom fields with the same name in Project Online

    Today I discovered something interesting when creating custom fields in Project Online.
    I usually create a certain set of custom fields that are useful to have on both the project and the task level. An example of these is Reportable, which I use to determine which tasks to roll up into reports and also which projects overall to report on.
    So I created a project level custom field called Reportable. No problem.
    I then created a custom field on the task level called Reportable. And the computer said no!
    I then learned that although you could do this in Project Server 2013, you can't in Project Online. You can't have duplicate custom field names, even if they are of different types.
    This has led me to use a naming standard, such as Reportable Task and Reportable Project. But I really don't like that as codes are for computers, not us humans. So I hope this changes in the future, but for now you just need to think about how you approach
    the fields.
    Good luck!
    Ryan Darby
    National Manager PMO
    www.ipmo.com.au
    www.projectonline.com.au

    Hi Ryan,
    I would follow Ben on this..
    Just made a test on a Project 2013 instance on-premise and I cannot create a task ECF and a project ECF with the same name. The same test on a Online instance returns the same result: the ECF names must be unique whatever the entity is.
    Waiting for Ben's confirmation.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Hiding Fields with the same name

    I have multiple fields across a form with the same name
    TxtName#1
    TxtName#2
    TxtName#3..... TxtName#24
    They are all share the same name because they should all have the same data.
    I want to be able to hide some of these fields, based on the number entered in another field TxtQty.
    for example if TxtQty=2 then
    TxtName#3-TxtName#24 will be hidden and only TxtName#1 and TxtName#2 will be visible.
    Can anyone please help?
    Thanks!

    The easiest way is to rename TxtName #1 and #2 to "TxtName2", and use the following custom Validate script for each:
    // Copy this field's value to the TxtName fields
    getField("TxtName").value = event.value;
    You can then hide all of the TxtName fields with:
    getField("TxtName").display = display.hidden;

  • How do I search all Contacts fields in the Q5 with OS10.2?

    Blackberry appear to be advancing backwards with their new Q5 and 10.2 operating system. I originally bought the Blackberry specifically for its ability to search into the notes field of email contacts, which no other phone could do at the time. When the operating system was "upgraded" to OS7 I was disappointed to find out that the Blackberry Search was no longer able to access the Contacts Notes field. But then I discovered the "OldSearch" app. This app replicated the old search functionality and I have been using it on my 9790 quite happily for the past two years. However, when the time came to renew my contract this year I made the BIG MISTAKE of assuming that the Q5 with its OS 10.2 would be a big step forward. I was VERY DISAPPOINTED. Once again the Blackberry search function could not search the notes field of Contacts but, worst of all, OldSearch cannot run on OS 10.2. After four days trying to persevere with the new menu format and combined with the search problem I decided to give up and hand the Q5 back. I have subsequently found out that most cell phones now have the facility to search into the Contacts notes, including the Samsung Galaxy and the iPhone. So, reluctantly, I say bye-bye Blackberry, hello Samsung S4.

    So, you're not really asking how to search contacts notes on the device. You just came to tell us you switched to to the S4.
    Good luck!
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • Person search to metadata field with search REST API on SP2013 online

    Hi!
    I'm developing a sandbox solution to be deloyed on SharePoint 2013 online. This solution contains a web part for a custom functionality. I have a need to make a query against data in user profiles based on two custom metadata properties (mapped to termsets).
    Is it possible to create this kind of query by using search REST API (with javascript)? So I need all persons whos metadata field
    MyOwnTerms contains specific value(s) passed to search?
    I can get all users with /_api/search/query?querytext='*'&sourceid='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'very (if i set the rowlimit to very high) and the results contains my cystom field
    MyOwnTerms but there is too much of results to loop through just for filtering. I cannot reduce rowlimit because I need ALL the persons with certain metadata value in this field. Is there any way to make this work?
    .Ana

    I went through the same problem and yes it is possible. In my case, I created a Managed Properties specific to my site column metadata, and assign the value only the label of the column metadata for this managed property. So it returns only the value of
    the name and not the metadata ID | Name as the default. 
    So, just move on selectproperties the name of your managed metadata, so it returns the correct value.

Maybe you are looking for

  • BootCamp drivers crash Windows 7, slow startup, boot order?, backup drive

    I have 3 issues that may be related or possibly not related to each other. I use an iMac (currently with Leopard 10.5.8 on a completely clean installation of both Leopard and Windows 7 on a freshly formatted and partitioned drive). Issues: 1. Before

  • Change Movement type 161 to Z61 for Returns Purchase Order

    Hi All, I have a requirement wherein the GOODS ISSUE against the Purchase Order with the returns flag (returns Purchase Order) should call out or post with a different movement type (ex. Z61) instead of the standard 161. Further, it should also updat

  • No sound heard in Audio Preview

    Hello when I speak on the mic, the green bar in audio preview goes up and down however no sound is heard. How do I hear the sound from the mic during preview? Thanks.

  • Receiver determination for ALEAUD??

    Hi,     I have configured my ALEAUD for a (B2B partner) R3 -> PI (B2b) - > PI (local) - >  R3 (local) scenario... I have requested the partner PI system to map their systems to my business systems in their Receiver determination step - header mapping

  • Malfunction after solder

    I have been searching online for hours and hours, and could find no solutions:?Last spring, my Zen Micro began having the "headphone jack problem." After finally becoming fed up with it, my dad found a guide showing how to solder and fix it. I had ne