CREATE Procedure hentSpecialPris
(
@.varenr int,
@.cvr int,
@.pris decimal(7,2) OUTPUT
)
AS
DECLARE @.antal int
SET @.antal = 0
SET @.antal = (SELECT COUNT(*) FROM rabat WHERE varenr=@.varenr and cvr = @.cvr)
IF @.antal < 1
BEGIN
SET @.pris = (SELECT pris FROM vare WHERE varenr=@.varenr)
END
ELSE
BEGIN
SET @.pris = (SELECT pris FROM rabat WHERE varenr=@.varenr and cvr = @.cvr)
END
GO
from another stored procedure?? I want to get the output value of the stored procedure?
CREATE PROCEDURE OtherProc @.varent int,@.cvr int
ASDECLARE @.pris decimal(7,2)
EXEC hentSpecialPris @.varent,@.cvt,@.pris OUTPUT
GO
You could also make this SP a user defined funciton, if it will always be called from another SP.
No comments:
Post a Comment