Select * from Table excep (Some columns)

  • Hi Friends,

    Here i am facing a issue in creation of a Stored Proc:

    The scenerio is , There is a "parent table" having 100 columns. From that different users can select different columns to display in their Inbox screen. Let us take an example that a user named 'X' selected first 20 columns and save the column names in "Preferencetable". So that whenever he again logged into his inbox , he need to see only the 20 columns data to be display. But actually the data was present in "Parent Table". So for selecting the those columns data excluding the remaining columns from "Parent table" , is there any script ot approach or syntax.

    Please help me out in this.

    Thank you in advance.

    Venu Gopal.K
    Software Engineer
    INDIA

  • Can you create views with the appropriate columns and let the user work with the view instead of the table?

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Sorry!!

    Views, While loops are not to be used in our environment.

    Thanks,

    Venu Gopal.K
    Software Engineer
    INDIA

  • venu_ksheerasagaram (10/13/2009)


    Sorry!!

    Views, While loops are not to be used in our environment.

    Thanks,

    dont understand that statement, are you saying views are not allowed in your environment. you could as Adi mentioned, create views dynamically based on what the end user selects, or create a dynamic query building up the column list based on what the user has selected. or store the query definition in a table based on the end users preference.

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

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

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