I am migrating my DB from a C++ Structure system to SQL. As an example, I take the 'Order Table'
The CPP struct for an Order comprises of a header, containing all sorts of usefull info, like who owns it, who donne it,how many items, followed by an array of 32 possible 'Order Items', each containing amongst others: a TimeStamp, A Quantity, a narrative, an amount, and a WhoDunneit, as wel as obscure CPP management information to avoid data clashes.
This goes together with carefully crafted rules about who can edit what. (Each user can only edit own items, but suitably empowered supervisory personell can edit all entries.)
The method that worked best was what we called the 'Pragmatic Upate' The Update that updates from the original datafirst, wins. All others fail, and get a view of the latest version. Does SQL act like this, or do i need tricks to implement this.
The table was stored in a file,as an array of structures of this kind.
I hope to re-write the new version in C# ,ASP.NET.
First Stumbling Block: how do I create my array of items in an SQL Database. (come to think of it, how do I create the 'Item' array element in the first place.)
Yes, SQL can store the data you describe quite well.
Here are a few terms you may want to research:
1) Primary key
2) Foreign key
Basically what you describe is a classic Master-detail relationship where the Order is the master and the Items are the details. You would define a primary key on the Order table which uniquely defines the order, then that primary key is used in the Items table as a foreign key (relating all of the Items back to the single Order).
When you do updates to the Order/Items, you will use a transaction which ensures that all of the updates across all of the records are performed consistently or not at all.
Hope this helps.
Last Visit: 31-Dec-99 18:00 Last Update: 30-Sep-16 6:42