When I try and read into my C# program using an SQLDataReader, the Discrepency field above defined above as varchar(512) gets truncated to 255 characters.
I verified that the ColumnSize is 512 with the following C# code:
SqlDataReader = dr2 = cmd2.ExecuteReader();
using (var schemaTable = dr2.GetSchemaTable())
{
foreach (DataRow row in schemaTable.Rows)
{
string ColumnName = row.Field<string>("ColumnName");
string DataTypeName = row.Field<string>("DataTypeName");
short NumericPrecision = row.Field<short>("NumericPrecision");
short NumericScale = row.Field<short>("NumericScale");
int ColumnSize = row.Field<int>("ColumnSize");
Console.WriteLine("Column: {0} Type: {1} Precision: {2} Scale: {3} ColumnSize {4}",
ColumnName, DataTypeName, NumericPrecision, NumericScale, ColumnSize);
}
}
Any ideas as to why it gets truncated?