48

Discovered one of the worst db designs ever:

- A cust is inserted in a table.
- The insert trigger is fired, calling a stored proc
- The stored proc being called creates a dynamic sql that builds a create table statement for 8 different tables. These tables will be postfixed with the newly-created cust id and is executed.

When querying info for a cust, a stored proc is used that accepts an id value would be appended to another dynamic sql that creates a select statement across all 8 tables for one customer.

Shoot me now.

Comments
  • 7
    I got as far as stored procedure creating customer specific tables.

    I don’t even want to know what drugs that dev / dba was smoking when they thought that was a good idea.

    Your only option is “DROP Database xyz” and walk away 🤮
  • 3
    @C0D4 probably something a part time or intern copied from search :p
  • 3
    @lotd let’s hope that’s the case, but then who ever approved, or didn’t approve and let it go into the wild, as such an atrocity should have been shot
  • 6
    @C0D4 I'll tell you even worse: this was in prod and was created by a senior dev.
  • 2
    @grumpylady01 that I would believe, it’s just surprising someone managed to think that was a good idea 😂

    Unless you have extremely active customers creating billions of records I can’t imagine a reason to create tables like that, plus doesn’t MS have restrictions on the number of tables you can create?
  • 1
    @C0D4 2.147 billion db objects to be exact (see: https://docs.microsoft.com/en-us/...).

    Clearly, the senior dev who developed this doesn't have the experience to design a relational db. What's more annoying is that the senior dev was proud of doing this work.
  • 3
    @grumpylady01 hey, at least you don’t need to worry about indexes. 😂😂
  • 2
    🔫
  • 1
    *Note stop making scheme while intoxicated.
  • 1
    Whip that idiot's ass hard! Then pay his/her college fees to go back to school.
Add Comment