Well, After looking the
datatype
of the columns(
varchar(50)
), I suspect the data may contain a
white space
character. So even if you order them correctly, as long a record contains a white space, the query result won't be as expected. Actually it is valid. However, it might not be what you expected. So double check the data contain a
white space
character. If so try to remove it. In addition to this, it is better to give appropriate data type for your columns, which must be relevant to your input data. Looking your table columns, If I were you, I will create the table as follows.
CREATE TABLE Header
(heading int,
subheading int,
date datetime)
)
I hope this helps you well.