Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculated Field
Message
De
14/07/2011 15:30:54
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01518145
Message ID:
01518173
Vues:
41
>>>So, I recommend to lean towards stored procedures for complex logic and not try to abuse functions (although, of course, they do have their place).
>>
>>so are you saying the code I wrote would work in an SP?
>
>I haven't studied your code in details, but generally, yes.

:)

I hope that someone can look at my code, because I'm stuck
CREATE PROCEDURE GetClaimStatus 
	-- Add the parameters for the stored procedure here
	@Clm_PK UNIQUEIDENTIFIER,
	@Status INT OUTPUT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	DECLARE @DayLimit INT
	DECLARE @Cli_PK UNIQUEIDENTIFIER
	
	SET @Status = 1 /* Pending */
	SET @Cli_PK = (SELECT clm_clifk FROM Claims WHERE clm_pk = @Cli_PK)
	
	SET @DayLimit = (SELECT com_OverDueDays 
					FROM Companies 
						INNER JOIN Clients ON com_pk = cli_comfk
							WHERE cli_comfk = @Cli_PK)

/* I don't know how to implement the logic:						
1. If any Claim Items are Overdue, then Claim is Overdue
2. Else If all Claim Items are Settled, then Claim is Settled
3. Otherwise Status is Pending */
			
    RETURN @Status 
END
GO
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform