12/10/2023 0 Comments Define duplicate![]() This behavior makes it harder to see how the stored procedure operates. In these 24-row result sets, the ROW_NUM values show that the stored procedure builds different “groups” based on the different values. If we restore the line 35 T-SQL WHERE clause and again run line 14 EXEC DYNAMIC_ROW_NUMBER_PARTITIONS 010001, we will get a different result set, as seen in this screenshot:Ĭlearly, the line 35 WHERE clause helps show how the stored procedure works, because when we disable it, the stored procedure returns 24 rows, for all input parameter values. Compared to EXEC DYNAMIC_ROW_NUMBER_PARTITIONS 001001 this result set looks very different, but it still returns 24 rows, as shown in this screenshot: If we comment out line 35 and run the stored procedure with line 14 EXEC DYNAMIC_ROW_NUMBER_PARTITIONS 010001 the result set defines duplicate rows based on the OFFICE_EQUIPMENT_NAME and PURCHASE_DATE column values. If we restore the line 35 T-SQL WHERE clause and again run line 12, the stored procedure returns the result set shown in this screenshot: The stored procedure returns a result set with 24 rows, as shown in this screenshot: If we comment out line 35 and run line 12 EXEC DYNAMIC_ROW_NUMBER_PARTITIONS 001001, the result set defines duplicate rows based on the OFFICE_EQUIPMENT_DESCRIPTION PURCHASE_DATE column values. The stored procedure does not necessarily need this filter, but with it, we can more clearly see how the engineering works. The stored procedure filters out rows with ROW_NUM values below 1, with the T-SQL WHERE clause at line 35. ![]() The result set defined duplicate rows based on the below column values: This screenshot runs line 13 EXEC DYNAMIC_ROW_NUMBER_PARTITIONS 001011 with a 001011 argument value: Later on, we’ll see how different argument values drive these definitions. The result set defined duplicate rows based on the PURCHASE_DATE column values. This screenshot runs line 11 EXEC DYNAMIC_ROW_NUMBER_PARTITIONS 000001 with a 000001 argument value: We can manually “paint” and run lines 11 through 14 to test the stored procedure. As seen in the above screenshot, the stored procedure has one integer data type parameter at line 4.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |