EjemplosDuoc.es.tl
  Function SqlServer
 
-- Ejemplo simple de creacion de funcion en SqlServer

CREATE FUNCTION SUMA(@UNO INT, @DOS INT)
RETURNS INT
WITH EXECUTE AS CALLER
AS
BEGIN
    DECLARE @RESULTADO INT
    SET @RESULTADO = @UNO + @DOS
RETURN(@RESULTADO)
END;


Ejecutar

DECLARE @RES INT
SET @RES = DBO.SUMA(1,1)
PRINT @RES

o

SELECT DBO.SUMA(1,1)
 
   
 
Este sitio web fue creado de forma gratuita con PaginaWebGratis.es. ¿Quieres también tu sitio web propio?
Registrarse gratis