Using Declare in SQL Server view -
i have query this:
declare @year_start int declare @year_end int set @year_start = 2005 set @year_end = 2014 ; p_year ( select p_year = @year_start union select p_year = p_year + 1 p_year p_year < @year_end ), interval (--- ), cte (--- ), cte_1 (--- ) select cte_1 rank <= 3 order
i tried using creating table valued function can't how manipulate variables in table valued function declaration.
whereas tried creating table valued function as:
create function p_count() returns table declare ... ...
i want make view declare
statement not allows me. how can make view?
your create function script misses begin
:
create function p_count() returns @tablename table (structure here) begin declare... ... return; end;
here syntax reference on msdn
Comments
Post a Comment