General - Do you know every object name should be owned by dbo?

Updated by Brook Jeynes [SSW] 2 years ago. See history

123
No component provided for introEmbed
CREATE PROCEDURE [Adam Cogan].[Sales by Year]
@Beginning_Date DateTime,
@Ending_Date DateTime AS
SELECT Orders.ShippedDate
,Orders.OrderID
,"vwOrderSubTotals".Subtotal
,DATENAME(yy,ShippedDate) AS Year
FROM Orders
INNER JOIN "vwOrderSubTotals"
ON Orders.OrderID = "vwOrderSubTotals".OrderID
WHERE Orders.ShippedDate Between @Beginning_Date And @Ending_Date

❌ Figure: Figure: Bad Example

CREATE PROCEDURE [dbo].[Sales by Year]
@Beginning_Date DateTime,
@Ending_Date DateTime AS
SELECT Orders.ShippedDate
,Orders.OrderID
,"vwOrderSubTotals".Subtotal
,DATENAME(yy,ShippedDate) AS Year
FROM Orders
INNER JOIN "vwOrderSubTotals"
ON Orders.OrderID = "vwOrderSubTotals".OrderID
WHERE Orders.ShippedDate Between @Beginning_Date And @Ending_Date

✅ Figure: Figure: Good Example

Acknowledgements

Adam Cogan
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star