Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
So here are tables from SQL EXEC SP's that forms synthetic keys.
What is the best way to create link table to eliminate synthetic keys from a SQL EXEC commands ?
[Sales ] :
Sales ID
Order ID
Customer ID
[Orders] :
OrderID
CustomerID
ProductID
[Product]:
ProductID
OrderID
Sales ID
Hi,
Really would need to see what the data was and get an understanding of what you are trying to do.
But generally you would alias the fields, you do not want to link on, leaving just one field linking two of the tables Some like
[Sales ] :
Sales ID
Order ID
Customer ID AS Sales.CustomerID
[Orders] :
OrderID
CustomerID
ProductID
[Product]:
ProductID
OrderID AS Product.OrderID
Sales ID AS Product.SalesID.
Would get rifd of your synthetic keys. Byt not knowing the Data is maybe you need to make concatenated keys to get the correct joins.
Mark
All the tables are being pulled from SP's
SQL EXEC [Reports].Report.[USP_GetSales];
I need to join all tables by a [%Key field] not just rename them
Hi, you can use precedent load like this
Load
Field1,
Field2 as %KEY_SOMETHING
;
SQL EXEC [Reports].Report.[USP_GetSales];
be sure to respect the actual field names from the SP response.
Regards