Griffo
Griffo

Reputation: 103

What is the best SQL field type to use for a Sqlite numeric

I am loading data from a sqlite database into a ms SQL database. The field type in the Sqlite is Numeric. What is the best field type to use so that I don't loose any detail?

Upvotes: 0

Views: 547

Answers (3)

Gordon Linoff
Gordon Linoff

Reputation: 1269873

What is the underlying data representing? Numeric in SQLite is a technically a column affinity and not a storage type. Other databases do not have the concept of "column affinity", which is explained here. In SQL Server, the types describe how the data is being stored.

The intention of a numeric column affinity is probably a fixed point numeric value. In that case, decimal/numeric would be the right type in SQL Server.

Note that numeric can also apply to dates, datetime, and boolean values. You would want to store these with the corresponding data types in SQL Server (probably date, datetime, or bit).

Upvotes: 1

Rafa Paez
Rafa Paez

Reputation: 4860

The best type to convert a NUMERIC column from SQLite to SQL Server is DECIMAL. http://msdn.microsoft.com/en-us/library/ms187746.aspx

Upvotes: 0

Hart CO
Hart CO

Reputation: 34774

My understanding of SQLite is limited, but from what I'm reading here: Datatypes in SQLite, the numeric affinity does not seem to actually tell you much about the data contained therein.

If that's the case, the best thing to do is to query the values to see what you're dealing with, then decide. Odds are it will be a FLOAT or DECIMAL.

Upvotes: 0

Related Questions