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.

AddCategory.sql 434B

123456789101112131415161718192021
  1. CREATE PROCEDURE [dbo].[AddCategory]
  2. -- Add the parameters for the function here
  3. @CategoryName nvarchar(64),
  4. @LogID int
  5. AS
  6. BEGIN
  7. SET NOCOUNT ON;
  8. DECLARE @CatID INT
  9. SELECT @CatID = CategoryID FROM Category WHERE CategoryName = @CategoryName
  10. IF @CatID IS NULL
  11. BEGIN
  12. INSERT INTO Category (CategoryName) VALUES(@CategoryName)
  13. SELECT @CatID = @@IDENTITY
  14. END
  15. EXEC InsertCategoryLog @CatID, @LogID
  16. RETURN @CatID
  17. END