can I use while loop for only one column?

  • Hi All,

    Please help me on below scenario.

    I am having application where user selects startdate and enddate from his application(front end). but if he selects Startdate is 2013/01/01 and EndDate as 2013/01/31. Then ihave to insert in the database as effetivedate which is calculated column based on startdate and enddate and will display all dates inbetween selected date. so in the above case,i want to insert effectiveDate as

    2013/01/01

    2013/01/02

    .

    .

    .

    .2013/01/31

    please help.

  • abhas (4/12/2013)


    Hi All,

    Please help me on below scenario.

    I am having application where user selects startdate and enddate from his application(front end). but if he selects Startdate is 2013/01/01 and EndDate as 2013/01/31. Then ihave to insert in the database as effetivedate which is calculated column based on startdate and enddate and will display all dates inbetween selected date. so in the above case,i want to insert effectiveDate as

    2013/01/01

    2013/01/02

    .

    .

    .

    .2013/01/31

    please help.

    You are going to have to give a better explanation than that for us to be able to help. Remember we can't see your screen, we don't know your data structures and we don't know what you are trying to accomplish.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • abhas (4/12/2013)


    Hi All,

    Please help me on below scenario.

    I am having application where user selects startdate and enddate from his application(front end). but if he selects Startdate is 2013/01/01 and EndDate as 2013/01/31. Then ihave to insert in the database as effetivedate which is calculated column based on startdate and enddate and will display all dates inbetween selected date. so in the above case,i want to insert effectiveDate as

    2013/01/01

    2013/01/02

    .

    .

    .

    .2013/01/31

    please help.

    Already answered here. Abhas, if you are unsure about any aspect of a solution offered to you, don't be afraid of asking for more information. Folks here will help you.

    β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Thanks Chris......... πŸ™‚

Viewing 4 posts - 1 through 3 (of 3 total)

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