Display values in row wise

  • I have 3 values e.g 100,200,300 and without inserting those values into any table I have to display those value in row wise.

    Example

    100,200,300

    after Query it will display like

    100

    200

    300

  • Here is an article that explains how tally tables can be used solve many RBAR problems in a set based method.

    http://www.sqlservercentral.com/articles/T-SQL/62867/[/url]

    --Ramesh


  • Use union

  • Any Idea how to insert the number of static data into a table

    example:

    I have data like 'AAA','BBB','CCC'...........................'ZZZ'

    without write the individual insert statement is it possible to insert those values into a single table

    table structure is the following

    Create table Temp (sData varchar(10))

    is there any way to insert those values into Temp table??

  • Does this do what you want?

    select top 26 replicate(char( row_number() over (order by object_id)+64),3)

    from sys.objects

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • vyas (2/5/2010)


    Use union

    Please show us how. 😉

    --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)

  • WayneS (2/5/2010)


    Does this do what you want?

    select top 26 replicate(char( row_number() over (order by object_id)+64),3)

    from sys.objects

    Heh... I can't tell if they want a split function or what you did.

    --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)

  • Query you provided is not generic one.

    please provide a generic query.with use that query we can split and insert into a table.

  • See the section on string splitting in Jeff Moden's tally table article. Link is in my sig below

    Edit: Apologies I see that somone has already pointed you to that article earlier.

    Doesn't mean you shouldn't read it though.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply