Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 52397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:54:02+00:00 2026-05-10T16:54:02+00:00

I’m writing an import utility that is using phone numbers as a unique key

  • 0

I’m writing an import utility that is using phone numbers as a unique key within the import.

I need to check that the phone number does not already exist in my DB. The problem is that phone numbers in the DB could have things like dashes and parenthesis and possibly other things. I wrote a function to remove these things, the problem is that it is slow and with thousands of records in my DB and thousands of records to import at once, this process can be unacceptably slow. I’ve already made the phone number column an index.

I tried using the script from this post:
T-SQL trim &nbsp (and other non-alphanumeric characters)

But that didn’t speed it up any.

Is there a faster way to remove non-numeric characters? Something that can perform well when 10,000 to 100,000 records have to be compared.

Whatever is done needs to perform fast.

Update
Given what people responded with, I think I’m going to have to clean the fields before I run the import utility.

To answer the question of what I’m writing the import utility in, it is a C# app. I’m comparing BIGINT to BIGINT now, with no need to alter DB data and I’m still taking a performance hit with a very small set of data (about 2000 records).

Could comparing BIGINT to BIGINT be slowing things down?

I’ve optimized the code side of my app as much as I can (removed regexes, removed unneccessary DB calls). Although I can’t isolate SQL as the source of the problem anymore, I still feel like it is.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:54:03+00:00Added an answer on May 10, 2026 at 4:54 pm

    I may misunderstand, but you’ve got two sets of data to remove the strings from one for current data in the database and then a new set whenever you import.

    For updating the existing records, I would just use SQL, that only has to happen once.

    However, SQL isn’t optimized for this sort of operation, since you said you are writing an import utility, I would do those updates in the context of the import utility itself, not in SQL. This would be much better performance wise. What are you writing the utility in?

    Also, I may be completely misunderstanding the process, so I apologize if off-base.

    Edit:
    For the initial update, if you are using SQL Server 2005, you could try a CLR function. Here’s a quick one using regex. Not sure how the performance would compare, I’ve never used this myself except for a quick test right now.

    using System;   using System.Data;   using System.Text.RegularExpressions;   using System.Data.SqlClient;   using System.Data.SqlTypes;   using Microsoft.SqlServer.Server;    public partial class UserDefinedFunctions   {       [Microsoft.SqlServer.Server.SqlFunction]       public static SqlString StripNonNumeric(SqlString input)       {           Regex regEx = new Regex(@'\D');           return regEx.Replace(input.Value, '');       }   };   

    After this is deployed, to update you could just use:

    UPDATE table SET phoneNumber = dbo.StripNonNumeric(phoneNumber) 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 72k
  • Answers 72k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The standard way to check if procedure exists is if… May 11, 2026 at 1:30 pm
  • added an answer Something like this might work: stamp=/tmp/mystamp # create stamp file,… May 11, 2026 at 1:30 pm
  • added an answer You will probably want to create an Abstract Factory or… May 11, 2026 at 1:30 pm

Related Questions

No related questions found

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.