Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading uncommitted data
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01426495
Message ID:
01426515
Vues:
47
Hi Hugo,

Maybe I'm missing something but it looks like you're trying to get data from the record that has not been inserted yet. Isn't it the one you're creating in the trigger?
Can you describe what're you trying to do?


>Sorry Sergey, I misnamed them, they are actually two scalar functions, my bad.
>
>Also I forgot to post the code for the important one, as it is the one that uses the same table that is being inserted
>
>
>USE [TVM]
>GO
>/****** Object:  UserDefinedFunction [dbo].[getClearedEventFaultsLogPK]    Script Date: 09/28/2009 12:18:24 ******/
>SET ANSI_NULLS ON
>GO
>SET QUOTED_IDENTIFIER ON
>GO
>-- =============================================
>-- Author:		RAN02
>-- Create date: 2009-09-27
>-- Description:	Returns the PK from FaultsLog for an event that was cleared
>-- =============================================
>ALTER FUNCTION [dbo].[getClearedEventFaultsLogPK] 
>(
>	@iEventPK int,
>	@iDevicePK int
>)
>RETURNS int
>AS
>BEGIN
>	-- Declare the return variable here
>	DECLARE @iFKFaultsLog int
>
>	-- Add the T-SQL statements to compute the return value here
>	SET @iFKFaultsLog =	(
>							SELECT TOP 1
>										FL.PK
>								FROM	TVM.dbo.FaultsLog FL
>								JOIN	TVM.dbo.EventsLog EL ON FL.fkEventsLog = EL.PK
>								WHERE	EL.fkEventDefinitions = @iEventPK and EL.SetFlag = 1 and FL.fkDevices = @iDevicePK
>								ORDER	BY EL.Created DESC
>						)
>
>	-- Return the result of the function
>	RETURN @iFKFaultsLog
>
>END
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform