Hello Everyone! In this article, we want to discuss a nice function of adding the value of every row to the next in SQL Server. Before we get started, if you want to know about using multiple columns with “Not In”, please go through the following article: SQL: Can you use multiple columns for NOT IN.

Sometimes we need to select data with the auto-generated sequence “Serial No” from the table. It may have an auto-generated column in your table. But when you select data with some condition, the column is may not be sequential. Then what you do?? It’s very simple to generate an auto-sequential number with “ROW_NUMBER()“.

Please see the table structure first:

adding value of every row to the next

The article was published on October 27, 2014 @ 10:54 AM

Leave a Comment