Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.0 KiB

  1. SET QUOTED_IDENTIFIER ON
  2. GO
  3. SET ANSI_NULLS ON
  4. GO
  5. CREATE PROCEDURE sp_DeleteSolution
  6. @BucketId varchar(100)
  7. AS
  8. BEGIN
  9. DECLARE @iBucket AS int
  10. DECLARE @DelId AS int
  11. SELECT @iBucket = iBucket FROM BucketToInt
  12. WHERE BucketId = @BucketId
  13. DELETE FROM RaidBugs
  14. WHERE iBucket = @iBucket
  15. SELECT @DelId = SolId FROM SolutionsMap
  16. WHERE iBucket = @iBucket
  17. DELETE FROM SolutionsMap
  18. WHERE iBucket = @iBucket
  19. IF NOT EXISTS (SELECT * FROM Solutions WHERE SolId = @DelId)
  20. BEGIN
  21. -- No one else used the same solution
  22. DELETE FROM Solutions
  23. WHERE @DelId = Solutions.SolId
  24. END
  25. SELECT @DelId = CommentId FROM CommentMap
  26. WHERE iBucket = @iBucket
  27. DELETE FROM CommentMap
  28. WHERE iBucket = @iBucket
  29. IF NOT EXISTS (SELECT * FROM Comments WHERE CommentId = @DelId)
  30. BEGIN
  31. -- No one else used the same solution
  32. DELETE FROM Coments
  33. WHERE @DelId = Comments.CommentId
  34. END
  35. END
  36. GO
  37. SET QUOTED_IDENTIFIER OFF
  38. GO
  39. SET ANSI_NULLS ON
  40. GO