If exists (Select * from sys.objects where name = 'stp_Select_CurNotUsu')
begin 
	drop procedure stp_Select_CurNotUsu
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_CurNotUsu
	-- 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 
		intCursoId, vchTitulo, vchDescripcionCorta, vchDescripcion, decCosto, decIva, decCostoTotal, datFalta, bitActivo
	From 
		dbo.tbl_det_Cursos
	Where 
		intCursoId not in (
							Select 
								intCursoId
							From 	
								UserQC.tbl_rel_Cursos_Usuario
							Where 
								intUsuario = @intUsuario)
	Order by datFalta

		
	

END
GO
