MONTHS AND QUATER

  • I HAVE TABLE SOMETHING LIKE THIS:

    CREATE TABLE #Parm_Filter

    (

    [Parm] [varchar](50) NULL,

    [PRMLabel] [varchar](200) NULL,

    [PRMValue] [varchar](200) NULL,

    [PRMOrder] [int] NULL

    )

    WANT TO INSERT SOMETHING LIKE THIS:

    PRMLabelPRMValueParmPRMOrder

    January1Month1

    February2Month2

    March3Month3

    April4Month4

    May5Month5

    June6Month6

    July7Month7

    August8Month8

    September9Month9

    October10Month10

    November11Month11

    December12Month12

    1st1Quarter1

    2nd2Quarter2

    3rd3Quarter3

    4th4Quarter4

  • What exactly is your question?

    And what is the purpose of this table? To me it seems a little strange....



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • I have to do something in report using this table.

  • komal145 (9/14/2011)


    I have to do something in report using this table.

    That doesn't really answer the questions.

    There are several things wrong with the table design as well as the concept in general:

    1) Why would a column that would hold max. 9 character (September) be specified as varchar(200)?

    2) PRMValue seems to hold tinyint values only. Why is it varchar(200)?

    3) What is the primary key and the clustered index?

    4) What would you do in case of the requirement to display the month name in a different language (e.g. Spanish)?

    5) If this is some sort of listbox, why isn't it hardcoded in the app? (What are the chances to have a 5th quarter or a 13th month?)

    Until we have more details what you're trying to approach, all I can say is: it should be possible to insert the values presented into the posted target table design. But I currently don't see a reason for doing so.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • komal145 (9/14/2011)


    I HAVE TABLE SOMETHING LIKE THIS:

    CREATE TABLE #Parm_Filter

    (

    [Parm] [varchar](50) NULL,

    [PRMLabel] [varchar](200) NULL,

    [PRMValue] [varchar](200) NULL,

    [PRMOrder] [int] NULL

    )

    WANT TO INSERT SOMETHING LIKE THIS:

    PRMLabelPRMValueParmPRMOrder

    January1Month1

    February2Month2

    March3Month3

    April4Month4

    May5Month5

    June6Month6

    July7Month7

    August8Month8

    September9Month9

    October10Month10

    November11Month11

    December12Month12

    1st1Quarter1

    2nd2Quarter2

    3rd3Quarter3

    4th4Quarter4

    Here I'm inserting a sample row into the table... I understand the question as you have to insert the data into the table

    CREATE TABLE #Parm_Filter

    (

    [Parm] [varchar](50) NULL,

    [PRMLabel] [varchar](200) NULL,

    [PRMValue] [varchar](200) NULL,

    [PRMOrder] [int] NULL

    )

    GO

    Insert into #Parm_Filter(PRMLabel,PRMValue,Parm,PRMOrder)

    Values('January','1','Month','1')

    GO

    SELECT PRMLabel,PRMValue,Parm,PRMOrder FROM #Parm_Filter

    GO

    [font="Tahoma"]
    --SQLFRNDZ[/url]
    [/font]

  • komal145 (9/14/2011)


    I HAVE TABLE SOMETHING LIKE THIS:

    CREATE TABLE #Parm_Filter

    (

    [Parm] [varchar](50) NULL,

    [PRMLabel] [varchar](200) NULL,

    [PRMValue] [varchar](200) NULL,

    [PRMOrder] [int] NULL

    )

    WANT TO INSERT SOMETHING LIKE THIS:

    PRMLabelPRMValueParmPRMOrder

    January1Month1

    February2Month2

    March3Month3

    April4Month4

    May5Month5

    June6Month6

    July7Month7

    August8Month8

    September9Month9

    October10Month10

    November11Month11

    December12Month12

    1st1Quarter1

    2nd2Quarter2

    3rd3Quarter3

    4th4Quarter4

    Ummmm... I suggest that you tell us what you actually want to use the table for... whatever it is you want to do, there might be a better way. Please don't take this as a slam... it's just an observation. If you don't know how to do this simple table population, I'm thinking you might be in over your head for whatever else you might need to do and, if we knew what it was, we might be able to help.

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

Viewing 6 posts - 1 through 5 (of 5 total)

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