• dwain.c (7/2/2013)


    erikd (7/2/2013)


    I work with a lot of tables, but none of them are very large.

    Please don't get me wrong when I say this. That is today. Once your application is successful beyond your wildest dreams and your tables start having many millions of rows, you'll probably be forced to rethink that statement. Performance should rarely be measured as "good enough," mainly because by the time it becomes "not good enough" it will be a serious challenge to make it good enough once again.

    erikd (7/2/2013)


    Here's what it returns from the second number you posted:

    select dbo.extractinteger('123A123456789') as [For Dwain]

    For Dwain

    123123456789

    I have your string splitter link open in a new tab. Will read and get back to you when I've tried it out a bit.

    I knew the answer but what I was wondering is does that seem like the right thing to do? For example suppose the string was 123456789x1231 where x denotes an extension.

    I hope you find value in the article. Like I said, I consider PatternSplitCM to be sort of a stopgap even though for the task it does it performs reasonably well. Most of the time, you'll find you can construct a more direct approach to a particular problem that will run faster.

    PatternSplitCM will get you to working code faster but with a little more effort you can get your code working faster.

    Did I just say that? 😉

    No, you're right. Good enough isn't good enough. What I was getting at is that I don't have a table large enough to test good enough against better or best. I don't even have a particularly good testing environment (a SQL 2005 instance on a rather ancient and rickety server that half a dozen people RDP into at a time). But, a guy can dream, when he's done dreaming about Johnnie Walker Blue and rare steaks.

    Phone numbers with extensions are screened out, because they can't be auto dialed, so it's GENERALLY not an issue, though it's caused a few headaches when clients send over their contact lists with everything plopped into one column.

    I am going to try to thumb wrestle your pattern splitter to do what mine does and just return the cleaned result.