If exists (Select * from sys.objects where name = 'stp_Select_RelUsuCur')
begin 
	drop procedure stp_Select_RelUsuCur
END
GO


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>	
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE stp_Select_RelUsuCur
	-- Add the parameters for the stored procedure here
	@intUsuario 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
	Select 
		DC.intCursoId, 
		DC.vchTitulo, 
		DC.vchDescripcionCorta, 
		DC.vchDescripcion, 
		DC.decCosto, 
		DC.decIva, 
		DC.decCostoTotal, 
		DC.datFalta, 
		DC.bitActivo
	From 	
		UserQC.tbl_rel_Cursos_Usuario RCU
	Inner Join 
		dbo.tbl_det_Cursos DC
		ON RCU.intCursoId = DC.intCursoId
	Where 
		intUsuario = @intUsuario
	Order by 
		datFalta desc
		
	

END
GO
