.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Copy phone numbers from results grid to excel, numbers have leading 0

Posted By:      Posted Date: November 20, 2010    Points: 0   Category :Sql Server

Hi I need to copy a column of phone numbers into excel they should be treated as text however excel wants to treat it as a number.

Is there anything I can do to force excel to treat the copy and paste from management studio as text and retain the leading 0?

View Complete Post

More Related Resource Links

Regular Expression for Canonical address format for phone numbers?

The canonical address format is a universal (international) phone number format and it's pattern is as following:

+ Country/RegionCode (AreaCode)SubscriberNumber

+1 (425) 555-0100

I need a regular expression that supports this?

Why wont my numbers in my grid align to the right


Here is my grid code: the amt column wont align to the right :(

<asp:GridView ID="gvNoAnnData" runat="server" AutoGenerateColumns="False"
            AllowSorting="True" BackColor="White" BorderColor="#999999" BorderStyle="None"
            BorderWidth="1px" CellPadding="2" GridLines="Vertical" Width="80%">
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White"
HorizontalAlign="left" />
                <asp:BoundField DataField="fNo" HeaderText="F #" SortExpression="fNo"
                    InsertVisible="False" ReadOnly="True" Visible="true" >

Gridview of users with phone numbers


Hey Guys,

I'm creating a list of departments as linkbuttons, when clicked these linkbuttons bring up a list of people in that department in a gridview and thanks to some other peoples help this is working great. The next step for me is to get the phone number to display in the column next to their name, it sounds like an easy thing to do as I've pulled phone numbers accross from AD before but just can't get it to work now!

The end result I'm hoping for would be like:

Charlie Brown | 01234 567890

Mona Lisa       | 01234 567890


My code is:

    class Employee
        public string Name { get; set; }
        public string Number { get; set; }
    class EmployeeList : List<Employee>
protected void LinkButton1_Click(object sender, EventArgs e)
        SearchResultCollection results = null;
        EmployeeList elst = new EmployeeList();
            string path = "LDAP://server.company.company.company/ou=company,DC=company,DC=company,DC=company";
            DirectoryEntry entry = new DirectoryEntry(path);
            DirectorySearcher mySearcher = new DirectorySearcher(entry);
            mySearcher.Filter = "(&(objectClass=user)(|(department=IT*)))";
            results = mySearcher.F

SSIS package to import excel 2007 with different column numbers



I have an already developed SSIS 2005 package which can import maximum of 50 columns of *.xlsx file. The file format is same except with the column numbers. I have many components in SSIS package (e.g. unpivot data, derrived column etc) which are developed for 50 columns. The package works fine for importing 50 columns. But sometimes it fails for excel sheet having 12 columns (columns < 50) it gives error for the source columns cannot be found. Surprisingly, if the contents are copied to another file it may work but not surely. Please let me know if I can do anything in existing package.

Thanks in advance,

looking for 7 digit phone numbers


How would I write a select statement to locate phone numbers that only contained 7 continuous digits?  I'm trying to locate numbers that were entered into the database without the area code.  Is there code that I could use to return only phone numbers that have 7 digits and no more?

Lee Markum

Excel won't search and find numbers


my excel program will not search and find numbers in new documents.!!!
Spreadsheets I prepare now which have numbers do not respond to the search command when I search for numbers.

If i search for a number, say 7647, i find several files that contain that number.

If I create a new spreadsheet with the number 7647 in it, save it, and then search for 7647, that spreadsheet does not show up in the list.

Also, if I search for a number in an older sheet, say 2345, and find one that has that number, and then ADD to that spreadsheet a new number , say 3456, save it, and search for 3456, that sheet is not found. So i can find all existing numbers that are there, but I can not search an find NEW numbers added to an old spreadsheet, nor to a new one.

It is like i have done something to my computer or excel program that is causing the search for numbers to not work.

The same is NOT true for text searches...They work fine all the time.

Also the Number search works fine in Word Documents, but not in excel.

Generate Random Numbers

SQL Server has a built-in function that generates a random number, the RAND() mathematical function. The RAND math function returns a random float value from 0 through 1.

Two numbers after dot



How to do this:

10 becames 10.00

12.3 becames 12.30

14.23 becames 14.23

Thanks you

accept numbers only , telephone validation



my requirement is textbox has to accept only numbers and  " ( ) - " symbols only.

any code plz


Excel file not showing in search results

We have a strange issue. I have one Excel document (or at least one that I am aware of) that will not show up in search results for content within the document. I can find the document by title just fine, but when I search for words within the document I do not see it. The document was originally a 2003 Excel document and was recently converted to 2007. Other than that there isn't really anything unusual about it (some formatting stuff, but mainly just background colors and whatnot, nothing fancy). The crawl log shows the document was crawled without error. Anyone know anything else I can check on?

Add page numbers for paging in data view web part


Hello all,

Has anyone found a solution that will allow me to have page numbers for paging in a data view web part. For instance, if I have 40 items/rows and I set the paging to display 10 items, I'd like the paging to show 1 2 3 4 rather than showing 1-10 and having to click next over and over to get to a specific item.

I found this article, but it is for 2003 and doesn't seem to apply to 2007 or if it does I am not able to really figure out how.


Please help!

Thanks in advance.


Last numbers from a string


I need a vb function to determine the last numerical characters in a string. For example, if the string is Step1, I need it to return 1. If the string is Step32, I need it to return 32.

I'm aware of the string functions like Right, Instr, etc but I'm just not sure how to get what I need. Any suggestions?

get the string of 6 numbers following a dash and a space

I need to retrieve a string of 6 numbers which following a dash and space e.g - "John Smiley - 023112 - California" I would like to get the "023112" part

Help: Rounding off numbers

I'm having some problems when it comes to rounding off numbers. In the reports I build the users wants to see the numbers in M$ or k? . that is Million$ or kilo?. So what I do is take the money and divide it by 1.000.000 or just by 1.000. The thing is that if a number is 750.000 and I divide it by 1.000.000 it should say 0,75M? for example. But nooo, it says 1M?, and that's not right. Any suggestions?  Thanks in advanced

How to skip page numbers?

I have a SSRS (2005) report with multiple subreports inside of it. Page numbers are displayed on the footer of the "outer" report. After one specific subreport, though, the user wants to have space to insert three pages from a different source, so she wants the page number on the footer to be increased by three. I tried a gazillion things, but it seems that the only possible way is to print three empty pages and replace them (what a waste) before distributing the report. Any suggestion?

Prefix in Numbers

how can i determine prefix of numbers in SQL? for example i want to select records that their ids starts with "123".

RegEx for numbers, letters & underscores only

I have this code:public bool IsAlphaNumeric(String strToCheck){  Regex objAlphaNumericPattern=new Regex("[^a-zA-Z0-9]");  return !objAlphaNumericPattern.IsMatch(strToCheck); } how do I modify the Regex to also accept underscores? 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend