what I am trying to do is: sort people in database after date of birth (nvarchar, not date type) the date is in this string format: dd-MM-yyyy and by Sort, i mean return a list of all the people, but sorted after the date of birth, to Fill a datagridview.
I have a column with the date of birth, which is nvarchar. I want to store the day, the month and the year in 3 variables in the sql query, and also test them in order to put them in order.
what I tried is:
SELECT SUBSTRING(date_of_birth,0,2) FROM people AS zi;
SUBSTRING(date_of_birth,3,2) AS luna
SUBSTRING(date_of_birth,6,4) AS an
SELECT [id], [specie], [sex], [date_of_birth], [greutate] FROM [people] WHERE
but I really don't know how to figure it out from now on...