listing_01.Getting Rows m to n Using a UDF

listing_01.Getting Rows m to n Using a UDF - datetime NULL...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 LISTING 1: Getting Rows m to n Using a UDF CREATE FUNCTION ufn_GetOrders ( @firstrow AS int, @lastrow AS int ) RETURNS @Orders TABLE ( RowNum int NOT NULL IDENTITY(1, 1) PRIMARY KEY, OrderID int NOT NULL, CustomerID nchar(5) NULL, EmployeeID int NULL, OrderDate
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: datetime NULL ) AS BEGIN INSERT INTO @Orders(OrderID, CustomerID, EmployeeID, OrderDate) SELECT OrderID, CustomerID, EmployeeID, OrderDate FROM Orders ORDER BY OrderID DELETE FROM @Orders WHERE RowNum < @firstrow OR RowNum > @lastrow RETURN END...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online