jokedst / CsvQuery

Plugin for Notepad++ that treats CSV files as (read only) SQL tables
153 stars 28 forks source link

ROW_NUMBER not supported #31

Closed danmigdev closed 2 years ago

danmigdev commented 2 years ago

Hi! Is the ROW_NUMBER function actually supported? Any alternatives? Thanks!

jokedst commented 2 years ago

The version of SQLite included in CsvQuery does not support window functions, and never will. There are workarounds, like this one: https://stackoverflow.com/questions/16847574/how-to-use-row-number-in-sqlite

If you absolutely MUST have this, you can use SQL Server as backend instead. You need SQL Server installed locally (there are free versions). Perhaps I should write something about how to set that up on the main page...

But basically you need SQL Server installed (with integrated security enabled, but that's he default). Create an empty DB in SQL Server, e.g. "CsvQueryDB" Go to N++ -> Plugins -> CsvQuery -> Settings Set "StorageProvider" to MSSQL Set "Database" to "CsvQueryDB" Now click "Read File" again, and it will become a table in that database, and you can use SQL Server syntax in CsvQuery, including ROW_NUMBER.