SQL Reporting format Phone Field

I have a stored procedure that returns a a string as 12345678900000.  I use this stored procedure in my SQL Server Report.  I want to display it is the format as (123) 456-7890.

I found the following wihch returns the value: (123) 456-7890000

=System.Text.RegularExpressions.Regex.Replace(Fields!VendorPhone.Value, "(\d{3})[ -.]*(\d{3})[ -.]*(\d{4})", "($1) $2-$3")

What can i change in this value to only display the first 10 digits?  In other words, how can I drop the 4 remaining zeros?

How can I do this in the SQL Report?  We're using SQL 2008
ortherAsked:
Who is Participating?
 
sureshbabukrishConnect With a Mentor Commented:
try this

System.Text.RegularExpressions.Regex.Replace(Left(Fields!VendorPhone.Value,10), "(\d{3})[ -.]*(\d{3})[ -.]*(\d{4})", "($1) $2-$3")

0
 
shorakCommented:
or this:

=left(System.Text.RegularExpressions.Regex.Replace(Fields!VendorPhone.Value, "(\d{3})[ -.]*(\d{3})[ -.]*(\d{4})", "($1) $2-$3"),10)
0
 
ortherAuthor Commented:
Fast too
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.