I have edited the stored procedure but it keeps crashing the database server when I try to run it. Any idea what I have done wrong? Sorry if this is a novice question, but should I change "CREATE" to "UPDATE" when I edit the procedure?
CREATE PROCEDURE [dbo].[CSK_Stats_FavoriteProducts]
(
@userName nvarchar(50)
)
AS
SELECT DISTINCT TOP 3 CSK_Stats_Tracker.userName, CSK_Stats_Tracker.createdOn, CSK_Store_Product.productGUID, CSK_Store_Product.productName,
COUNT(CSK_Stats_Tracker.trackingID) AS ViewCount, CSK_Store_Product.defaultImage, CSK_Store_Product.productID
FROM CSK_Stats_Tracker INNER JOIN
CSK_Store_Product ON CSK_Stats_Tracker.productSKU = CSK_Store_Product.sku
WHERE (CSK_Stats_Tracker.userName = @userName)
GROUP BY CSK_Stats_Tracker.userName, CSK_Store_Product.productGUID, CSK_Store_Product.productName, CSK_Store_Product.defaultImage,
CSK_Store_Product.productID
ORDER BY CSK_Stats_Tracker.createdOn DESC
RETURN