Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/07/2012, 19:35
natiii_fl
 
Fecha de Ingreso: julio-2012
Mensajes: 1
Antigüedad: 11 años, 10 meses
Puntos: 0
Problemas con trigger

Hola como dice el titulo me han solicitado crear un trigger que cuente el total delineas x empresas pero nose como hacerlo ydonde lo mstrara yo tengo esto


TENGO MI SP QUE INSERTA

________________
[COLOR="rgb(46, 139, 87)"]USE [TransantiagoFINAL]
GO

CREATE PROCEDURE [dbo].[insertLineaXEmpresa]
-- Add the parameters for the stored procedure here
@linea int,@rut int, @tipo_linea int
AS
BEGIN


INSERT into Linea_por_Empresa values (@linea,@rut,@tipo_linea)
END[/COLOR]



_______________

ESTA BUENO Y EL TRIGGER QUE CREE ES ESTE
___________________


USE [TransantiagoFINAL]
GO

CREATE TRIGGER [dbo].[contadorlineaXempresa]
ON [dbo].[Linea_por_Empresa]
AFTER INSERT

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for trigger here
declare
@linea int, @cont int

Select count (Linea)
From Linea_por_Empresa LPE
WHERE @linea= Linea

return
END



LOS 2 NO TIRAN ERROR PERO CREO QUE ESTAN MAL HECHOS PORQUE NO ME TIRA NINGUN RESULTA Y SI LO HACE NOSE DONDE :s

AVER SI ALGUIEN ME PUEDE AYUDAR PLISSS