I love the “View Update SQL” button on the SalesPad mobile server installer. This button generates the SQL that is about to be executed against your GP database into a notepad window for inspection. It was reassuring to see and understand what was about to be done to the database.
If you look above you will see the way that SalesPad embrace namespaces for the objects that form their systems. They are up front and in in front of your eyes.
So I started reading the SQL, sadly enjoying it – as you do, knowing that you tick all the boxes of the Facebook nerd test. Here is what the resulting script looked like…
Looking through I recognised much SQL analogous to that I’ve written before, myself for auto fulfilment and handling multiple bins. I did especially like the way they create a virtual table as a view for resolving SOPTYPE. It is a SQL technique I’ve seen elsewhere and I should adopt it more in my coding. I have also seen it used inside stored procedures too, in a similar way to create a virtual table to join against, as a common table expression.
Also note that they put all the db objects into the [spgpm] database schema, so I’m not the only one using schemas for what the creator intended! See my other post: Care naming database objects in Dynamics GP for custom GP Addins.