0

I am trying to create a column with incrementing numbers inside a group as per Table below.

RecordID OrderID IncrementInGroup
a 1 1
b 2 1
c 3 1
a 4 2
a 5 3
a 6 4
a 7 5
b 8 2
c 9 2

I am having dozens of millions of rows. I guess VIEW would be enough as I want this to pick up with Power BI app. Is it possible to do for an existing table?

Thom A
  • 88,727
  • 11
  • 45
  • 75
Likvor
  • 1
  • 1
  • 1
    Is SQL Server 2005 even supported by (current versions of) PowerBI? SQL Server 2005's support ended *completely* over *6 years* ago; it it *long* past time you sorted out your upgrade path. – Thom A Aug 18 '22 at 08:37
  • 1
    Looks like you just want a `ROW_NUMBER` though; I'm pretty sure that was supported in SQL Server 2005, but I haven't touched that version of SQL Server since 2009! – Thom A Aug 18 '22 at 08:38
  • Also, `INDEX` has a specific meaning in database engines, what you want here isn't an index, nor are you *indexing*. It isn't a `SEQUENCE` either, which is a tool added in SQL Server 2012, that has similar functionality to an `IDENTITY`. Also [please do not upload images of code/data/errors when asking a question.](//meta.stackoverflow.com/q/285551) – Thom A Aug 18 '22 at 08:42

0 Answers0