Matt G
Matt G

Reputation: 77

SQL Server add row numbers without ordering

I have a massive data file (tab delimited). I'm experiencing a data shift- at some point, the date field becomes populated with non-date values (the words from the description field to the left of it). As you can imagine, I can't just scroll through the text file, or plop it into excel to dig around- I need to know where to look.

I am trying to add row numbers to the imported table, so that I can identify the row where the data shift occurs. So, I am wondering if there is a way to insert row numbers without having to order by anything (i.e. essentially number the rows of the original data file).

Using

ROW_Number() OVER (ORDER BY (___))

I'm not sure how to accomplish what I'm trying to do, because I can't order on anything- it needs to be numbered exactly as it was imported.

Upvotes: 0

Views: 155

Answers (1)

Tab Alleman
Tab Alleman

Reputation: 31785

I think your best bet is to import it into a staging table with an IDENTITY column added to it.

Upvotes: 5

Related Questions