Advertisement
Diego1764

TABLA CATEGORIA [SSMS]

Jun 16th, 2025
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.08 KB | None | 0 0
  1. -- TABLA CATEGORIA
  2. CREATE PROCEDURE inserta_categoria
  3.     @codi_cate int,
  4.     @nombre nvarchar(15),
  5.     @descripcion nvarchar(20)
  6. AS
  7. BEGIN
  8.     INSERT INTO CATEGORIA (codi_cate, nombre, descripcion)
  9.     VALUES (@codi_cate, @nombre, @descripcion)
  10. END
  11. -- *******************************************************
  12. CREATE PROCEDURE actualiza_categoria
  13.     @codi_cate int,
  14.     @nombre nvarchar(15),
  15.     @descripcion nvarchar(20)
  16. AS
  17. BEGIN
  18.     UPDATE CATEGORIA
  19.     SET
  20.         nombre = @nombre,
  21.         descripcion = @descripcion
  22.     WHERE codi_cate = @codi_cate
  23. END
  24. -- *******************************************************
  25. CREATE PROCEDURE elimina_categoria
  26.     @codi_cate int
  27. AS
  28. BEGIN
  29.     DELETE FROM CATEGORIA
  30.     WHERE codi_cate = @codi_cate
  31. END
  32. -- *******************************************************
  33. CREATE PROCEDURE consulta_categoria
  34.     @codi_cate int,
  35.     @nombre nvarchar(15) OUTPUT,
  36.     @descripcion nvarchar(20) OUTPUT
  37. AS
  38. BEGIN
  39.     SELECT
  40.         @nombre = nombre,
  41.         @descripcion = descripcion
  42.     FROM CATEGORIA
  43.     WHERE codi_cate = @codi_cate
  44. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement