Maximum size for text data type

Hey!

I was trying to store JSON strings using text data type. It will be helpful if I could know what is the maximum size of text data type in outsystems?

Hi Shashankit Thakur,


After doing some search for this topic I found this community discussion and also please read out the João Batista reply. Hope this discussion will be a help for your query. 


Kind Regards,

Benjith Sam


Shashankit Thakur wrote:

Hey!

I was trying to store JSON strings using text data type. It will be helpful if I could know what is the maximum size of text data type in outsystems?

Hi Shashankit Thakur,

It depends on the database which you are using. for example if you are using SQL server 12 the max length is 4000 Character.


Raj wrote:

Shashankit Thakur wrote:

Hey!

I was trying to store JSON strings using text data type. It will be helpful if I could know what is the maximum size of text data type in outsystems?

Hi Shashankit Thakur,

It depends on the database which you are using. for example if you are using SQL server 12 the max length is 4000 Character.


Thanks!


Hi,

For strings bigger than 2000 outsystems uses nvarchar(max). 

The max size for a column of type NVARCHAR(MAX) is 2 GByte of storage.

Since NVARCHAR uses 2 bytes per character, that's approx. 1 billion characters

Regards,

Marcelo

Neither this thread, nor the one linked above, answers the question!


Outsystems may USE varchar(max), but if you set it to 4000, would that still limit it to 4000 characters?

Hi Nathan,

Yes Outsystems will limit it.

Regards,

Marcelo

So if you want the maximum space, what length value do you use... the max value for an int is 2,147,483,647, so can we just whack in 999999999 (999 million etc)

Hi Nathan,

Never tried it before but in theory it should work. If you end up doing the experiment share with us the result.

Regards,

Marcelo

In case anyone's interested, we gave it a spin so we could store the diff snapshot of a large form. It took 15 minutes to publish and there's no abort button so we're currently considering a different solution...

Hi,

We do storage of large JSON, or XML strings by defining the attribute data type as Binary. Then using TextToBinary from the Binary espace to convert the text prior to storing it, and BinaryToText to convert it back to a text after reading it. Now you do not have to worry about size property of the attribute. You could decide to redesign your entity and create a 1 on 1 entity just to store the binary separate from the other attributes of your entity, with the primairy key set to the identifier of your original table. 

Ideally OutSystems should support the JSON data type natively for an entity attribute. There is already an idea for that that you can vote for.

https://www.outsystems.com/ideas/5310/JSON+datatype+in+Outsystems?IsFromAdvancedSearch=True

Regards,

Daniel

Hi All,

In my case as Ferreira said, I have increased text length to 2500 and OutSystems / SQL Server automatically created nvarchar(max) in database.


Sravan