Using local function parameter inside a while loop - SQL Server -


My inline table function prints numbers from 1 to number which is the input in the function. Since I'm new to SQL Server, I'm not sure how to implement a little loop inside the function. My implementation is as below as expected that I get a lot of compiler errors at WHILE , BEGIN , THEN . Can someone suggest how I can improve the code? Thanks!

  Build number num_F (@nnn INT) return form in return form (select when @nnn = 0 then more than tap when dbo.num_F (@nnn) & gt; 0 BEGIN Then go to First_Col as DB Num_f (@nnn) SET dbo.num_F (@nnn) = dbo.num_F (@nnn) -1 END as First_Col ASC)  

Code> is done in the most simple way by using General Table Expression (CTE) class = "post-text" itemprop = "text">

  Built-in function Numfunctn1 (@ number INT) return as table return (in the form of CTS (selection 1 came) Mr. union all select ID CTE WHERE id + 1 & lt; @num) SELECT * FROM cte) SELECT * Numfunctn1 (10)  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -