Hi Bruce,
I have started using GUIDs in all my tables and find the concept to be very useful especially when needing a "unique non-changing key".
I have a question about SQL views. I have NetWebBrowse procs on SQL views and they consist of aggregate data and hence there is no GUID available. For example a view defined as follows:
CREATE VIEW vwCustomerItemSales as
SELECT cust.GUID, item.GUID, min(cust.CustomerName), min(item.ItemSKU), min(item.Description), sum(inv.Qty), sum(inv.Amount)
FROM Customers as cust join Invoices as inv on inv.CustomerGUID=cust.GUID
join Items as item on inv.ItemGUID=item.GUID
GROUP BY cust.GUID, item.GUID
for tables Customers, Invoices and Items defined as below:
Customers:
GUID varchar(16),
CustomerName varchar(100)
Invoices:
GUID varchar(16),
Qty decimal(10,2),
Amount decimal(10,2)
Items:
GUID varchar(16),
ItemSKU varchar(20),
Description varchar(100)
What should I use for the unique key in this case?
I was thinking of combining cust.GUID and item.GUID which will give a STRING of length 32 characters.
But in some cases, there could be three GUIDs.
Appreciate your input on this.
Thanks
&
Regards,
Ubaidullah Nubar.