Querying all rows from range of numerically named columns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dbrewerton
    New Member
    • Nov 2009
    • 115

    Querying all rows from range of numerically named columns

    Let us suppose the columns in my table read something like 100,101,102,103 ,104 and so on (for an extreme example 100 columns).

    What I am looking for is a way to see all rows in those columns but I want to specify two numbers, a low and high to specify my column range.

    Any idea how this can be done would be super. Thanks!
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    That's a really bad design.

    The solution to your problem would be to fix the layout of your database.

    Do a google search on "database design" and/or "database normalization".

    Comment

    • dbrewerton
      New Member
      • Nov 2009
      • 115

      #3
      Ok, so your solution is completely rip the database and stored procedures apart that were written by someone else? If that were the answer I would not ask the question. Really not very helpful to be honest.

      Comment

      • dbrewerton
        New Member
        • Nov 2009
        • 115

        #4
        And incidentally, this is a temporary table.

        Comment

        • RonB
          Recognized Expert Contributor
          • Jun 2009
          • 589

          #5
          Your question as posed is not really related to sql. it's a question related to the scripting language you're using to run your query.

          Within that language you need to build the FROM clause of the select statement based on your low and high column names/numbers. The syntax required to do that will depend on your scripting language.

          If that approach isn't going to work for you, then you'll need to provide more details about your setup so we can better understand what you need.

          Comment

          • dbrewerton
            New Member
            • Nov 2009
            • 115

            #6
            Became a non-issue anyway, the project is dead. But I learned a lot nevertheless.

            Comment

            Working...