-- ============================================= -- Author: -- Create date: -- Description: -- ============================================= CREATE FUNCTION [C6MartPeriodico].[FrequenzaElab] ( ) RETURNS @pippo TABLE ( -- Add the column definitions for the TABLE variable here periodo varchar(1) ) AS BEGIN declare @tipoElab varchar(1) select @tipoElab=C6MartPeriodico.getTipoElab(); INSERT INTO @pippo SELECT 'T' AS PERIODO if @tipoElab = 'S' INSERT INTO @pippo SELECT 'S' AS PERIODO if @tipoElab = 'A' INSERT INTO @pippo SELECT 'S' AS PERIODO UNION ALL SELECT 'A' RETURN END