Cómo ejecutar la función Table valued
Tengo la siguiente función que devuelve la tabla .
create Function FN(@Str varchar(30))
returns
@Names table(name varchar(25))
as
begin
while (charindex(',', @str) > 0)
begin
insert into @Names values(substring(@str, 1, charindex(',', @str) - 1))
set @str = substring(@str, charindex(',', @str) + 1, 100)
end
insert into @Names values(@str)
return
end
¿Podría alguien explicarme cómo ejecutar esta función?
49
2 answers
Se supone que una TVF (función de valor de tabla) debe seleccionarse. Prueba esto:
select * from FN('myFunc')
87
Author: Paul Creasey,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-08-05 09:47:59
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-08-05 09:47:59
Puede ejecutarlo tal como seleccione una tabla usando la cláusula SELECT
. Además, puede proporcionar parámetros entre paréntesis.
Pruebe con la siguiente sintaxis:
SELECT * FROM yourFunctionName(parameter1, parameter2)
44
Author: Shiham,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-08 16:28:57
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-08 16:28:57