Formate Phone Number Field
Jan 17, 2005
Hi,
I need to formate one of my phone number field in SQL. now the data in the field is: 1234567890. I would like to formate the number to 123-456-7890. Does anyone know how to do this? Thanks.
Nicole
View 5 Replies
Feb 12, 2013
I have a table filled with phone numbers entered in every different way possible
(5551212, 1115551212, 111-555-1212, 111 555 1212, 111-555-1212 ex 1234, 5551212 x1234)
And I would like to pull them from the table using sql 2008 and have the formatting look like this:
(111)555-1212 x1234.
How can I make this happen? Where numbers are missing, I would prefer to leave the area blank, ie 5551212 becomes 555-1212, and 1115551212 becomes (111)555-1212, extension numbers only where they are currently included.
View 14 Replies
View Related
Jul 15, 2014
I am trying to get my SQL create table to work for my phone number formatting and it is not. When I create the below code, the default is set to 3 numbers only.
CREATE SET TABLE dl_qpt_cqe.contacts, NO FALLBACK ,NO BEFORE JOURNAL,NO AFTER JOURNAL
(contact_id integer not null ,contact varchar(50) , jobtitle varchar(50), dept varchar(50), phone integer format '999-999-9999', phone_ext varchar(10), email varchar(50), constraint pk primary key (contact_id));
Is there some other way I need to format the phone portion so the default is 999-999-9999?
View 1 Replies
View Related
Oct 27, 2015
I am learning the string functions and the database that I'm using is AdventureWorks2012.However ,while practicing I was just trying to hide the phone number with '*' mark,but not getting the desired result.So the code is.............
SELECT
PhoneNumber, (SUBSTRING(PhoneNumber,1,2)+REPLICATE('*',8)+
SUBSTRING(PhoneNumber,CHARINDEX('[0-9][0-9]{1,2}',PhoneNumber),LEN('-555-01')))AS[PhoneNumber]
FROM
Person.PersonPhone
[code]....
View 6 Replies
View Related
Apr 30, 2015
Below is my sample data. I can't figure out how to select Unique phonenumber contacts for the same Ranked values from the set.
Basically the table is a mix of contactIDs. Some of them have duplicate phone numbers and through a separate mechanism we have ranked them.
It's easier then to pull out max(ranked) CLI_Numbers and their counterpart contactID(s). But I am also getting 2 or more records where the rank happens to be the same. I don't want that. Any one of the contactID will do for me.
The table has also same cliNumbers with different rank values, which are then correctly being picked up in the query below.
Note: ContactId is a unique value for each person in the table.
RecordID is simply RowID.
( I have attempted to populate a sample data suited for this forum - not sure how it comes out on the browser)
if object_id('tempdb..#MyData') is not null
drop table #MyData
create table #MyData
(
RecordID int,
contactID int,
forename varchar(25),
surname varchar(25),
[Code] ....
This is my query attempt
With RankedmobileDuplicateSet
as(
select cliNumber, max(ranked_value) as ranked_max_value
from #temp_UK_mobiledata
group by cliNumber)
[Code] .....
View 2 Replies
View Related
Jul 22, 2004
I tried searching forums for the last hour and could not find much.
Rather then doing...
REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(RE PLACE(ISNULL(PHONE, ''), ' ', ''), '(', ''), ')', ''), '-', ''), '.', ''), ':', ''), '+', '')
I was hoping there was an equally efficient alternative that utilizes PATINDEX('%[^0-9]%', PHONE)
to some capacity (i.e. uses regular expressions to strip all non-numeric characters from the phone field)
I am certain this has been addressed before, just not sure if the "REPLACE to the nth degree" is the only solution.
THANKS!
View 7 Replies
View Related
Dec 4, 2007
hi,
i need a report formate mention below
the formate should reach 100% as given below
can anybody help me out
i using SQL Reporting Service 2000
Profit and Loss Satement for "California" region
For the fiscal year 2007
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Total
Revenue
Gross Sales
$11,737
$12,655
$11,783
$13,606
$11,787
$13,003
$11,599
$14,932
$12,862
$13,078
$15,285
$16,839
$159,168
Cost of Goods Sold
$0
$0
$0
$0
$0
$0
$0
$0
$0
$0
$0
$0
$0
Total Revenue
$11,737
$12,655
$11,783
$13,606
$11,787
$13,003
$11,599
$14,932
$12,862
$13,078
$15,285
$16,839
$159,168
Net Sales
$11,737
$12,655
$11,783
$13,606
$11,787
$13,003
$11,599
$14,932
$12,862
$13,078
$15,285
$16,839
$159,168
Total Net Sales
$11,737
$12,655
$11,783
$13,606
$11,787
$13,003
$11,599
$14,932
$12,862
$13,078
$15,285
$16,839
$159,168
Expenses
General & Administration
$1,198
$1,198
$1,198
$1,198
$1,198
$1,198
$1,198
$1,198
$1,198
$1,198
$1,198
$1,198
$14,381
Information System
$2,059
$2,059
$2,059
$2,059
$2,059
$2,059
$2,059
$2,059
$2,059
$2,059
$2,059
$2,059
$24,709
Marketing
$2,891
$2,891
$2,891
$2,891
$2,891
$2,891
$2,911
$2,911
$2,911
$2,911
$2,911
$2,911
$34,813
Lease
$1,107
$1,107
$1,107
$1,107
$1,107
$1,107
$1,107
$1,107
$1,107
$1,107
$1,107
$1,107
$13,285
Total Expenses
$7,256
$7,256
$7,256
$7,256
$7,256
$7,256
$7,276
$7,276
$7,276
$7,276
$7,276
$7,276
$87,188
Gross Profit
$4,482
$5,399
$4,528
$6,350
$4,532
$5,748
$4,324
$7,657
$5,587
$5,802
$8,009
$9,563
$71,980
Gross Profit Margin
38.18%
42.66%
38.42%
46.67%
38.45%
44.20%
37.28%
51.28%
43.44%
44.37%
52.40%
56.79%
$5
Expenses / Sales
61.82%
57.34%
61.58%
53.33%
61.55%
55.80%
62.72%
48.72%
56.56%
55.63%
47.60%
43.21%
$7
View 3 Replies
View Related