I am new to Microsoft SQL, and I am attempting to import a database from MySQL. The only issue that I am having is that the MySQL database uses the longtext
data type for several table columns.
What Microsoft SQL datatype is analogous to MySQL longtext
?
Thank you for your time.
LONGTEXT. LONGTEXT can store the maximum characters among all four, up to 4,294,967,295 characters i,e 4,294,967,295 bytes or 4GB. This is more than enough storage for any long-form text strings. For example, a book that MEDIUMTEXT can't hold can be stored using LONGTEXT.
TEXT has a maximum length of 65,535 bytes—the same as VARCHAR. MEDIUMTEXT has a maximum length of about 16 megabytes. LONGTEXT has a maximum length of about 4 gigabytes.
You can get the MySQL table columns data type with the help of “information_schema. columns”. SELECT DATA_TYPE from INFORMATION_SCHEMA. COLUMNS where table_schema = 'yourDatabaseName' and table_name = 'yourTableName'.
LONG is not a valid data type in any version of SQL Server.
Microsoft SQL Server has NTEXT
and NVARCHAR(MAX)
which are both very similar; NVARCHAR(MAX)
(or VARCHAR(MAX)
if you don't need to handle internationalisation) is recommended over the earlier NTEXT
(and TEXT
again if you don't need to store anything other than a single codepage.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With