How can I insert over 8000 bytes into SQL using C #?

How can I insert over 8000 bytes into SQL using C #? I have a large amount of text that I want to save in varchar, 8000 bytes seems to be the limit, can I increase this?

thanks

+4
source share
4 answers

what version of SQL are you using? SQL 2008 supports the varchar (MAX) variable, which can significantly increase the amount of text.

Update: Sorry that Microsoft SQL 2005 and above ... varchar (MAX) may contain 2 GB of data ... you did not indicate whether you are using MS-SQL, so I made an assumption.

+6
source

Use nvarchar (max) or varchar (max) as nText and Text are deprecated.

+3
source

Starting with SQL2005, you can define VARCHAR(MAX) or NVARCHAR(MAX) , which gives you all the benefits of VARCHAR without the lower TEXT descriptors.

+3
source

You can use nText for anything in Unicode more than 8000 characters. The nText field is 1,073,741,823 characters in size. If you are not using Unicode and you need even more space, you can use text that has 2147 483 647 characters.

However, nText and Text are deprecated in favor of using VARCHAR (MAX), which can hold up to 2 GB of data. The VARCHAR (MAX) data type uses an overflow page for anything more than 8KB in a row, so performance can suffer if it's too much out of control.

+3
source

All Articles