Seguimos buscando a Arshak. Ayudanos compartiendo!
Encuesta no oficial de docentes
Resultados de la encuesta no oficial de docentes
Probaste el SIGA Helper?

Donar $100 Donar $200 Donar $500 Donar mensualmente


Enviar respuesta 
 
Calificación:
  • 0 votos - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
Buscar en el tema
AYUDA con FUNCIONES
Autor Mensaje
Gra Sin conexión
Empleado del buffet
Con esfuerzo. Se puede!!
*

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 12
Agradecimientos dados: 38
Agradecimientos: 53 en 8 posts
Registro en: Oct 2014
Mensaje: #1
AYUDA con FUNCIONES Parciales Gestión de Datos
Estoy tratando de hacer el ejercicio 4 del parcial de Lacquanitti que dice asi:
IMPLEMENTAR EL/LOS OBJETOS NECESARIOS PARA QUE DADA UNA FACTURA SE RETORNE UN ENTERO QUE INDIQUE "1" SI ESA FACTURA TIENE PRODUCTOS QUE PODRIAN VENDERSE COMO COMPOSICION Ó "0" EN CASO CONTRARIO.

yo hice esto pero se que no esta bien... Si alguien me ayuda se lo voy a agradecer!!!!!!!
/** resuelvo con una FUNCION **/
/*Considero que un PRODUCTO SI tiene componentes @RTA = 0 o un PRODUCTO NO tiene componentes @RTA = 1 */


use GD2015C1
GO
create function ejer4(@NROFACTURA varchar(8))
returns int
AS
begin
declare @RTA int
IF exists (/* SOLO es VERDADERO si Existe algun PRODUCTOS TIENEN COMPONENTES porque esta sin JOIN, no considera NULL*/
Select prod_codigo
From Producto p, Composicion C, Factura F, Item_Factura I
where p.prod_codigo = c.comp_producto and item_numero= fact_numero
and fact_numero = @NROFACTURA
and item_producto=prod_codigo
and fact_sucursal=item_sucursal and fact_tipo=item_tipo)

begin
SET @RTA = 0 /* El producto SI tiene componentes */
end
else
begin
SET @RTA =1 /*El producto NO tiene componentes*/
end

return @RTA
end
GO
24-01-2017 20:52
Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
Buscar en el tema
Enviar respuesta 




Usuario(s) navegando en este tema: 1 invitado(s)