Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL longtext analogue in Microsoft SQL?

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.

like image 621
Oliver Spryn Avatar asked Mar 24 '12 17:03

Oliver Spryn


People also ask

What is Longtext SQL?

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.

What is difference between TEXT and Longtext in MySQL?

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.

How do I find the datatype of a column in SQL?

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'.

Does SQL support long data type?

LONG is not a valid data type in any version of SQL Server.


1 Answers

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.)

like image 76
Rowland Shaw Avatar answered Sep 22 '22 10:09

Rowland Shaw