SqlServer ntext truncated

  • Thread starter Thread starter Peter Morris
  • Start date Start date
P

Peter Morris

Hi all

I am inserting data into an ntext column in SqlServer 2000 but it is being
truncated. In every StackTrace and Steps column (the only 2 ntext columns)
I am seeing the text truncated to about 255 chars. Can anyone tell me why
this is, and maybe how to solve the problem?


Thanks

Pete




InsertLogCommand = Connection.CreateCommand();
InsertLogCommand.CommandText = "Insert into ErrorLog (DataFromPPC, DateTime,
Description, Steps, StackTrace) values (@DataFromPPC, @DateTime,
@Description, @Steps, @StackTrace)";

parameter = new SqlParameter();
parameter.ParameterName = "@DataFromPPC";
parameter.SqlDbType = System.Data.SqlDbType.Int;
InsertLogCommand.Parameters.Add(parameter);

parameter = new SqlParameter();
parameter.ParameterName = "@DateTime";
parameter.SqlDbType = System.Data.SqlDbType.DateTime;
InsertLogCommand.Parameters.Add(parameter);

parameter = new SqlParameter();
parameter.ParameterName = "@Description";
parameter.SqlDbType = System.Data.SqlDbType.VarChar;
InsertLogCommand.Parameters.Add(parameter);

parameter = new SqlParameter();
parameter.ParameterName = "@Steps";
parameter.SqlDbType = System.Data.SqlDbType.VarChar;
InsertLogCommand.Parameters.Add(parameter);

parameter = new SqlParameter();
parameter.ParameterName = "@StackTrace";
parameter.SqlDbType = System.Data.SqlDbType.VarChar;
InsertLogCommand.Parameters.Add(parameter);


while ......
{
InsertLogCommand.Parameters["@DateTime"].Value = logDateTime;
InsertLogCommand.Parameters["@DataFromPPC"].Value = archiveID;
InsertLogCommand.Parameters["@Description"].Value = description;
InsertLogCommand.Parameters["@Steps"].Value = steps;
InsertLogCommand.Parameters["@StackTrace"].Value = stackTrace;
InsertLogCommand.ExecuteNonQuery();
}
 
It would appear that all of the data is there, but when I use SQL query
analyzer and then doing ctrl+A / ctrl+C to copy the columns contents does
not get all of the data. How can I view the entire contents in the query
analyzer?


Thanks

Pete
 
Peter said:
It would appear that all of the data is there, but when I use SQL
query analyzer and then doing ctrl+A / ctrl+C to copy the columns
contents does not get all of the data. How can I view the entire
contents in the query analyzer?

Query Analyzer has a built-in limit to the max number of text it will bring
back in a query. If you hunt around in the Options dialog you will find it.
I believe the default is around 2k.
 
Back
Top