October 10, 2019 at 8:30 pm
*/So, this is part of the create SP.
Sample structure is
CREATE SP
(
@Column1,
@Column2,
-----
--
)
CREATE TABLE #Abandoned
(
)
INSERT INTO #Abandoned
(
)
And then Below code.
*/
SELECT * FROM -- Question. How can I replace it with only columns...trying to understand( SELECT ROW_NUMBER() OVER(ORDER BY -- is this a sub query ??
CASE WHEN @SortAscending = 1 THEN Received END ASC,
CASE WHEN @SortAscending = 0 THEN Received END DESC) AS ROWID,
RT_ID,
RTType_ID,
Purse_ID,
Received,
TransactionAmount,
PurseName,
Application_ID,
DemoAccount_ID,
TransactionDescription,
Abandon_ID_ID,
(SELECT count(*) FROM #Abandoned) AS TotalRowCount
FROM #Abandoned
) AS TempTable
WHERE ROWID BETWEEN @StartRow AND @EndRow
END
GO
October 11, 2019 at 2:27 pm
Please use the Insert/edit code sample
at the top of the box where you enter text to post. It retains your formatting.
Because you didn't use it, your formatting is all messed up and it's not clear where your line breaks should be.
Assuming that I understand your query correctly, there is a subquery that defines a row number, HOWEVER there is no FROM
clause, so the rowset for the subquery contains exactly one row (the one row from the main query) and the resulting ROW_NUMBER()
will ALWAYS be 1.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply