What datatype should be used for storing phone numbers in SQL Server 2005

0 votes
I need to save contact information in a table. Which datatype should I use, please advise. Wait. Please continue reading before responding.

Given that sales representatives can utilize this field for searches, it needs to be heavily indexed (including wild character search).

We currently anticipate that phone numbers will come in a variety of formats (from an XML file). To convert to a standard format, do I need to develop a parser? It's possible that there may be millions of data (many of which will be duplicates), and I don't want to use up too many server resources on preprocessing each time any new source data is received.\

Can someone please help me with this?
Sep 10, 2022 in Database by Kithuzzz
• 38,000 points
1,660 views

1 answer to this question.

0 votes

Does this include:

  • International numbers?
  • Extensions?
  • Other information besides the actual number (like "ask for bobby")?

If all of these are no, I would use a 10 char field and strip out all non-numeric data. If the first is a yes and the other two are no, I'd use two varchar(50) fields, one for the original input and one with all non-numeric data striped and used for indexing. If 2 or 3 are yes, I think I'd do two fields and some kind of crazy parser to determine what is an extension or other data and deal with it appropriately. Of course, you could avoid the 2nd column by doing something with the index where it strips out the extra characters when creating the index, but I'd just make a second column and probably do the stripping of characters with a trigger.

I hope this helps you. 

answered Sep 11, 2022 by narikkadan
• 63,600 points

Related Questions In Database

0 votes
1 answer

What are the different authentication modes in SQL Server? How can it be changed?

Windows mode and Mixed Mode – SQL ...READ MORE

answered Oct 29, 2018 in Database by Sahiti
• 6,370 points
1,207 views
0 votes
0 answers

Which SQL server should we use for SQL queries to be executed?

I mean to say which SQL server ...READ MORE

Aug 18, 2019 in Database by Sonali
534 views
0 votes
1 answer

SQL Server replaces LEFT JOIN for LEFT OUTER JOIN in view query

You are getting the joins confused and ...READ MORE

answered Feb 4, 2022 in Database by Neha
• 9,020 points
1,481 views
0 votes
1 answer

How Can I use "Date" Datatype in sql server?

There's problem in all of them and ...READ MORE

answered Feb 9, 2022 in Database by Neha
• 9,020 points
1,346 views
0 votes
1 answer
0 votes
0 answers

What are Covering Indexes and Covered Queries in SQL Server?

Can you describe the ideas behind Covering ...READ MORE

Aug 21, 2022 in Database by Kithuzzz
• 38,000 points
506 views
0 votes
1 answer

How to find index from raw and column in python?

You probably want to use np.ravel_multi_index: import numpy as ...READ MORE

answered Sep 12, 2018 in Python by Priyaj
• 58,020 points
962 views
0 votes
1 answer

How to find index from raw and column in python?

You probably want to use np.ravel_multi_index: import numpy as ...READ MORE

answered Sep 24, 2018 in Python by Priyaj
• 58,020 points
1,289 views
0 votes
1 answer

Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452) in sql 2008

Solution Go to Start > Programs > Microsoft SQL Server > Enterprise Manager. Right-click the SQL ...READ MORE

answered Sep 12, 2022 in Database by narikkadan
• 63,600 points
1,090 views
0 votes
1 answer

What is the use of a cursor in SQL Server?

Instead of receiving a result set as ...READ MORE

answered Sep 13, 2022 in Database by narikkadan
• 63,600 points
763 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP