• shashianireddy (11/4/2013)


    Iam try this quarie but not display above format show as above

    For the given data, it certainly does. Please post the data you're using where it doesn't.

    Declare @tblTemp table ( ID int identity(1,1)

    , houseno NVARCHAR(MAX)

    )

    Insert into @tblTemp

    Select '3-13-1' union all

    Select '3-13-3/a' union all

    Select '3-13-3/b' union all

    Select '3-13-2/a' union all

    Select '3-13-4' union all

    Select '3-13-6' union all

    Select '3-13-5/a' union all

    Select '3-13-4/c'

    ;

    SELECT HouseNo

    FROM @tblTemp

    ORDER BY HouseNo

    ;

    Results from above...

    3-13-1

    3-13-2/a

    3-13-3/a

    3-13-3/b

    3-13-4

    3-13-4/c

    3-13-5/a

    3-13-6

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)