SQL Server Performance

Query Required splition of home address column in street name & house #

Discussion in 'ALL SQL SERVER QUESTIONS' started by waqar100, Jul 7, 2012.

  1. waqar100 New Member



    I have a columna name "home address" in which i have data like that ,mean there is house# with the street name,I want to fetch the column in house# & streetname


    13480 lone point lane
    4420 Douglas Ave. E
    10655 birch St


    I want to show separate the house# & streetname
    so i need

    house# streetname

    13480 lone point lane

    4420 Douglas Ave

    10655 birch St
  2. FrankKalis Moderator

    A very weak way to do this would be something like:
    Code:
    SELECT
        SUBSTRING(column, 0, CHARINDEX(' ', column, 1)),
        SUBSTRING(column, CHARINDEX(' ', column, 1), 8000)
    FROM
        Table;
    However, I suspect that you will run into all sorts of issues with your real data. Might be worth thinking about a data scrubbing task that brings the data into a "better" normalised form.
  3. Madhivanan Moderator

    Also is the format same for all set of data or different?
  4. waqar100 New Member

    I have resolved it

Share This Page