I have a database datatype defined as Text:
text columns are variable-length columns that can hold up to 2,147,483,647 (231 - 1) bytes of printable characters.
What does that means exactly? How many string characters will I be able to save into the Text column?
Basically, I try to save a c# string object into that column where
myString.ToString().Length == 39418
but when I pull it back from the database
myString.ToString().Length == 32768
-----------EDITED---------------
guys this is very confusing.
The Text column is defined as 2,147,483,647 bytes which is 2GB
The string i'm trying to save is ?System.Text.ASCIIEncoding.Unicode.GetByteCount(param.Value.ToString()) 78836 bytes i.e. 0.0000734217 gigabytes
So that confirms that what I am trying to save IS NOT too big for the Text datatype column? i.e. I'm saving 0.0000734217 GB into a column capable of handling 2GB
I'm using Sybase. Saving like this:
OdbcParameter param = new OdbcParameter();
param.DbType = DbType.String;
param.Size = int.MaxValue;
param.Value = myBigString
parameters.Add(param);
OdbcHelper.ExecuteNonQuery(connectionString, sql, parameters);
And retreiving like this
DataSet ds = new DataSet();
OdbcConnection conn = new OdbcConnection(connectionString);
OdbcDataAdapter adp = new OdbcDataAdapter(command, conn);
conn.Open();
adp.Fill(ds);....
Also when I try this I can still see the data is truncated so it doesn't look like a problem when retreiving the data
var obj = OdbcHelper.ExecuteScalar(connectionString, "select myBigString FROM ...");