IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[_ResumenItemDocumento]') AND type in (N'P', N'PC'))
BEGIN
execute('CREATE PROCEDURE [dbo].[_ResumenItemDocumento]
	-- Add the parameters for the stored procedure here
	@p_id_documento AS int,
	@p_id_usuario AS int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here

	declare @cadena as varchar(100)
	
	select @cadena=''Total Items: '' + cast(count(1) as varchar(100)) from doc_itemDocumento WHERE id_usuario_creo = @p_id_usuario and id_documento = @p_id_documento

	--String que se muestra en la pantalla itemDocumento, !SIEMPRE DEJAR ESTE SELECT @cadena DE ÚLTIMASˇ
	select @cadena

END')

END