Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Table column count competition

Table column count competition

Scheduled Pinned Locked Moved The Lounge
29 Posts 14 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P PIEBALDconsult

    Referential integrity would prevent that.

    Mike HankeyM Offline
    Mike HankeyM Offline
    Mike Hankey
    wrote on last edited by
    #13

    So would birth control!

    VS2010/Atmel Studio 6.0 ToDo Manager Extension
    Version 3.0 now available. There is no place like 127.0.0.1

    P 1 Reply Last reply
    0
    • A AspDotNetDev

      Darn, highest I could find was 84, using this query:

      SELECT
      t.Name AS [Table Name],
      COUNT(*) AS [Column Count]
      FROM sys.Tables AS t
      JOIN sys.Columns AS C
      ON t.Object_ID = c.Object_ID
      GROUP BY
      t.Name
      ORDER BY
      COUNT(*) DESC

      Credit to Pinal Dave for most of the code.

      Thou mewling ill-breeding pignut!

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #14

      SELECT TOP 1 * FROM
      (
      SELECT s.Name AS [Schema name]
      , t.Name AS [Table Name]
      , COUNT(*) AS [Column Count]
      FROM sys.Tables AS t
      JOIN sys.Schemas AS s
      ON T.schema_id=s.schema_id
      JOIN sys.Columns AS C
      ON t.Object_ID = c.Object_ID
      GROUP BY s.Name,t.Name
      ) T
      ORDER BY [Column Count] DESC

      Shows me 107.

      1 Reply Last reply
      0
      • Mike HankeyM Mike Hankey

        So would birth control!

        VS2010/Atmel Studio 6.0 ToDo Manager Extension
        Version 3.0 now available. There is no place like 127.0.0.1

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #15

        Too late for that.

        Mike HankeyM L 2 Replies Last reply
        0
        • P PIEBALDconsult

          Too late for that.

          Mike HankeyM Offline
          Mike HankeyM Offline
          Mike Hankey
          wrote on last edited by
          #16

          I'd recommend a lobotomy, but I'm afraid Mr. Fraiser has already had his!

          VS2010/Atmel Studio 6.0 ToDo Manager Extension
          Version 3.0 now available. There is no place like 127.0.0.1

          1 Reply Last reply
          0
          • P PIEBALDconsult

            Too late for that.

            L Offline
            L Offline
            lewax00
            wrote on last edited by
            #17

            Murder is just late term birth control.

            1 Reply Last reply
            0
            • V Vasily Tserekh

              I have a table in the application i am developing of 155 columns i dare anyone to beat me:mad: ps. the table is already in 3rd normal form

              E Offline
              E Offline
              Ennis Ray Lynch Jr
              wrote on last edited by
              #18

              Move it to the fourth normal and get rid of the nulls.

              Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

              L 1 Reply Last reply
              0
              • V Vasily Tserekh

                I have a table in the application i am developing of 155 columns i dare anyone to beat me:mad: ps. the table is already in 3rd normal form

                J Offline
                J Offline
                Jeremy Hutchinson
                wrote on last edited by
                #19

                We have a table with 289 columns. It's in our insurance reserves calculating database, and I have no idea what the table actually does, and I don't think I want to know (there are 7 tables with more than 140 columns)

                My Blog[^] Chess Tactics for WP7[^]

                1 Reply Last reply
                0
                • P PIEBALDconsult

                  GuyThiebaut wrote:

                  required for each row

                  GuyThiebaut wrote:

                  medical database

                  I'm not convinced -- if the table had columns for right and left arm etc., what did you do for patients with missing arms? Leave NULLs? I'd prefer to have different tables for different body parts. :-D

                  G Offline
                  G Offline
                  GuyThiebaut
                  wrote on last edited by
                  #20

                  Yes there are better ways of representing the data - it all depends on what you are going to do with it. If you are just looking at a simple full table scan then a wide row can be the best approach. The difficulty is that when you design your tables inevitably six months later there will be a better way to store the data based on how you now want to query it. In the end you just do the best you can with the information you have at the time and rely on the database engine to do the optimisation for you later - if things get really slow you can always de-normalise your data...

                  “That which can be asserted without evidence, can be dismissed without evidence.”

                  ― Christopher Hitchens

                  1 Reply Last reply
                  0
                  • V Vasily Tserekh

                    I have a table in the application i am developing of 155 columns i dare anyone to beat me:mad: ps. the table is already in 3rd normal form

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #21

                    Vasily Tserekh wrote:

                    I have a table in the application i am developing of 155 columns i dare anyone to beat me:mad:
                    ps. the table is already in 3rd normal form

                    155 attributes, all depending on the same key? And none that depend on a part of the key? No repeating groups? All atomic values? Show me :)

                    Bastard Programmer from Hell :suss:

                    V 1 Reply Last reply
                    0
                    • V Vasily Tserekh

                      I have a table in the application i am developing of 155 columns i dare anyone to beat me:mad: ps. the table is already in 3rd normal form

                      M Offline
                      M Offline
                      Mycroft Holmes
                      wrote on last edited by
                      #22

                      I needed to supply some data to a stress test system using SQL 2005, ran out of columns when I hit 1200, I was hoping to create a temp table with 3.6k columns because I could then use my nifty table to CSV utility. Devised a different strategy. I have seen many systems with over 200 columns in a table, usually legacy apps that migrated from power users to core system somehow.

                      Never underestimate the power of human stupidity RAH

                      1 Reply Last reply
                      0
                      • V Vasily Tserekh

                        I have a table in the application i am developing of 155 columns i dare anyone to beat me:mad: ps. the table is already in 3rd normal form

                        M Offline
                        M Offline
                        Matt Gullett
                        wrote on last edited by
                        #23

                        We have plenty of 3rd normal tables with more than 1024 columns (they are split across multiple tables). Market research surveys have a large number of data points sometimes.

                        1 Reply Last reply
                        0
                        • L Lost User

                          Vasily Tserekh wrote:

                          I have a table in the application i am developing of 155 columns i dare anyone to beat me:mad:
                          ps. the table is already in 3rd normal form

                          155 attributes, all depending on the same key? And none that depend on a part of the key? No repeating groups? All atomic values? Show me :)

                          Bastard Programmer from Hell :suss:

                          V Offline
                          V Offline
                          Vasily Tserekh
                          wrote on last edited by
                          #24

                          its an inspection form and every value its a part of the inspection list

                          L 1 Reply Last reply
                          0
                          • V Vasily Tserekh

                            its an inspection form and every value its a part of the inspection list

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #25

                            That's not an argument. I can show you a lot forms crammed with unrelated data - I want to see 155 attributes in 3NF, and them being in the same form doesn't necessarily mean that they should be in the same table. Simply listing their names will do :)

                            Bastard Programmer from Hell :suss:

                            1 Reply Last reply
                            0
                            • E Ennis Ray Lynch Jr

                              Move it to the fourth normal and get rid of the nulls.

                              Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #26

                              If it's that easy, then why do we rarely see a decently normalized database? OT; From the third, you'd go to BCNF. I don't see much added value in removing the optional fields.

                              Bastard Programmer from Hell :suss:

                              1 Reply Last reply
                              0
                              • G GuyThiebaut

                                Erm... :^) One database I worked on had a table that had to be split into two as there were more than 255 columns that were required for each row.... It's not as rare as it may sound particularly when you are dealing with something as complex as the human body(it was a medical database). That said - I am sure there are better ways of representing data than having so many columns populated for each row...

                                “That which can be asserted without evidence, can be dismissed without evidence.”

                                ― Christopher Hitchens

                                T Offline
                                T Offline
                                TheRealRarius
                                wrote on last edited by
                                #27

                                I just looked in the standatd demo database for Sage 200 accounts... There are four tables with over 100 columns and one with 427! This table is called setup and stores one record containing a load of the system settings for the application. God I love (not) Sage!

                                G 1 Reply Last reply
                                0
                                • T TheRealRarius

                                  I just looked in the standatd demo database for Sage 200 accounts... There are four tables with over 100 columns and one with 427! This table is called setup and stores one record containing a load of the system settings for the application. God I love (not) Sage!

                                  G Offline
                                  G Offline
                                  GuyThiebaut
                                  wrote on last edited by
                                  #28

                                  I take it there is a good data dictionary for these settings columns?

                                  “That which can be asserted without evidence, can be dismissed without evidence.”

                                  ― Christopher Hitchens

                                  T 1 Reply Last reply
                                  0
                                  • G GuyThiebaut

                                    I take it there is a good data dictionary for these settings columns?

                                    “That which can be asserted without evidence, can be dismissed without evidence.”

                                    ― Christopher Hitchens

                                    T Offline
                                    T Offline
                                    TheRealRarius
                                    wrote on last edited by
                                    #29

                                    This table isn't even mentioned in the database documentation. All the settings should be accessed through a .Net wrapper library, which helpfully renames some of the fields for no apparent reason.

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups