T-SQL ENHANCEMENTS length FLOAT ) GO fill

T-SQL ENHANCEMENTS length FLOAT ) GO fill table with some data DECLARE @index INT SET @index = 5 WHILE(@index > 0) BEGIN INSERT INTO BELT VALUES ( B + CONVERT(VARCHAR, @index), 10 * @index) SET @index = @index 1 END GO make a table-valued function CREATE FUNCTION Stretch (@length FLOAT) RETURN @T TABLE ( MinLength FLOAT, MaxLength FLOAT ) AS BEGIN IF (@length > 20) INSERT @T VALUES (@length 4, @length + 5) RETURN END GO SELECT B.* S.MinLength, S.MaxLength FROM Belt AS B CROSS APPLY Stretch(B.Length) AS S GO B30, 26, 35 B40, 36, 45 B50, 46, 55 The rows in the Belt table are cross-applied to the Stretch function. This function produces a table with a single row in it if the @lengthparameter passed into it is greater than 20; otherwise, it produces a table with no rows in it. The CROSS APPLY operator produces output when each table involved in the CROSS APPLY has at least one row in it. It is similar to a CROSS JOINin this respect. OUTER APPLYis similar to OUTER JOINin that it produces output for all rows involved in the OUTER APPLY. The following SQL batch shows the results of an OUTER APPLY involving the same Belt table and Stretch function as in the previous example.

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services

Bookmark the permalink.

Comments are closed.