Filter Result Set Based on First Letter

  • I would like to introduce some type of paging on a table with a large result set.  Basically, i would like to group all Vendors by first character.

    I was curious if a where vendor_name like 'a%'  would kill server performance.  This table contains a very large number of records.

  • Possibly, you might try WHERE LEFT(vendor_name, 1) = 'a'... that might work better.

  • If you have an index on vendor_name, a 'where vendor_name like 'a%' should result in an index seek.  If you don't have an index on this column, consider adding one.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • thanks for the suggestions.

  • LIKE 'A%' can give you great performance...  If you have an index on the column, as someone else mentioned.

Viewing 5 posts - 1 through 4 (of 4 total)

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