DevExpress formats columns differently if they're all numbers I have a table with a 'Code' column, defined as varchar.  However, if you have only numbers in some of the records, for this field, and you search on these records in our application, the results in grid (DevExpress) is formatted as numbers.

The moment you have records in the result that contains a-z, then the formatting does not happen.  So I'm trying to see if i can fix this from the database side.  I have created a view on the table, and changed the column in question to:

:
Code + CHAR(144) AS Code
:


This solves the formatting of the field in the grid.  The field will now always been seen as a string, even if the results only contains numbers.

The problem is however, if I now explicitly search on this value in our application's front-end, eg Code = 40E, I get no results, due to the special character (which is not visible).  So I have only partly solved the issue.  I have tried to add just a trailing space to the field at first, but that did not work.

Any ideas how this can be solved from the database, if possible at all?

I only have access to the SQL objects, hence I was trying to fix this through SQL.  Is there any way to address this in a database view, but also ensuring that there are no funny characters appended to the field value which affects the searching?
Force the GridView column format from the code behind:

using DevExpress.Utils;
// ...
GridColumn myCol = new GridColumn() { Caption = "TheColumn", Visible = true, FieldName = "ColumnName" };
colPayment.DisplayFormat.FormatType = FormatType.String; //Char, Varchar, or whatever option DE gives you to format the display
gridView1.Columns.Add(myCol)


If you're gonna add it from the code behind, if not access the Column and set the format. 

gridView1.Columns["TheColumn"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.String;


It is not an SQL issue, the data is stored in the format that is supposed to be stored, the frontend is the one supposed to handle the display format in this case. If you create a view the same deal will happen because the grid will still try to guess the column type. Talk to the dev.