mardi 6 octobre 2015

How to convert MS SQL query to SQLite

I need to migrate an old program from MS SQL to SQLite through ODBC. I don't have source code. It works perfect while writing the data, but some SELECTs with TOP clause doesn't work. The query string from the executable file is:

SELECT TOP %ld [%s] FROM [%s] WHERE ( [%s] < %f )

The query is against single field. I need to remove "TOP %ld" part but keep the result. The right query is something like:

SELECT "%s" FROM "%s" WHERE ( "%s" < %f )

This string is passed to sprintf or similar C function, so I need to have %ld as first parameter, but the result should be the same as first query.

Is there a way to keep %ld without changeing the result while changing the database from MS SQL to SQLite?

Aucun commentaire:

Enregistrer un commentaire