Im using Delphi XE2 and SQL Server 2005 Express.
I have a table named maintenance with the columns:
id Integer;
Activity Varchar(x); = actividad
Description Memo; = descripcion
Day Integer;= dia_sem
User Integer; = usuario
id, activity, description, day, user
I use this table to register the activities of maintenance that have to be donne in each day, as in Monday they have to clean behind x or y etc, on tuesdays they have to do something else etc.
I save the day from 1 to 7 being Sunday=1 to Saturday=7, so the program will retrieve all the activities where queryday.text= DayOfWeek(Now) and warn the users that there are activities to be donne.
My problem is that i want to show in a DBGrid the day with the full name and not as a number.
Sunday
Monday
Tuesday etc.
On SQL i get the full day name using:
Select id AS ID, actividad AS Actividad, descripcion AS Descripcion,(datename(weekday, dia_sem-2)) AS Dia, usuario AS Usuario
from mantenimiento
i set dia_sem-2
so it would match the day i want (Apparently Tuesday=1)
My problem is that when i add this query to a Tquery on delphi and i add the fields, the "day" field is not added, it doesnt exist. What am I doing wrong or how can i achieve what im trying to do?.