DROP PROCEDURE  IF EXISTS uspSetAlapertelmezettEmail 
GO

CREATE PROCEDURE uspSetAlapertelmezettEmail
   @pUserId INT
  ,@pTanevId INT
  ,@pTanuloId INT
AS
BEGIN
  SET NOCOUNT ON;

  UPDATE T_EMAIL_OSSZES
  SET C_ALAPERTELMEZETT = 'F'
    ,SERIAL = SERIAL + 1
    ,LASTCHANGED = GETDATE()
    ,MODIFIER = @pUserId
  WHERE TOROLT = 'F'
    AND C_FELHASZNALOID = @pTanuloId
    AND C_TANEVID = @pTanevId
    AND C_GONDVISELOID IS NULL
END
GO


