Upload
daaha2
View
214
Download
0
Embed Size (px)
DESCRIPTION
horses
Citation preview
----Mostrar los caballos que no han participado en ninguna carrera
--If OBJECT_ID('Cinactivo','P') IS NOT NULL--DROP PROCEDURE Cinactivo
Create Procedure Cinactivo
@IDC numeric(6)AsBegin
Declare @CARRERAC Cursor Set @CARRERAC = Cursor For Select ID_Caballo from CaballosOpen @CARRERAC
Fetch next from @CARRERAC into @IDCWhile @@FETCH_STATUS=0
BeginIf(Select ID_Caballo from Caballo_Carrera where ID_Caballo =@IDC) IS NULLSelect Nombre From Caballos Where ID_Caballo=@IDC
Fetch Next from @CARRERAC into @IDCEndClose @CARRERACDeallocate @CARRERAC
End
Go
EXEC Cinactivo@IDC = NULL