smsstech
asked on
Return modified datetime data in Select...Case
I have a stored procedure that returns appointment data into a form. Everything was working fine but I've been tasked with the following:
1. If the appointment is flagged as appAllDay = 1, the appointment start time (appDate) needs to display with a different time. The physical data isn't touched or changed.
For example, 2010-02-05 08:00:00.000 needs to display as 2010-02-05 11:00:00.000 in my appTime column shown below.
The appDate field is a datetime column so I'm not sure if this is even possible. Any assistance would be appreciated.
SELECT dbo.dbAppointments.appID,
(case appAllDay when 0 then appDate else
****
end) as appTime
FROM
dbo.dbAppointments
WHERE dbo.dbAppointments.feeusri d = 7459
1. If the appointment is flagged as appAllDay = 1, the appointment start time (appDate) needs to display with a different time. The physical data isn't touched or changed.
For example, 2010-02-05 08:00:00.000 needs to display as 2010-02-05 11:00:00.000 in my appTime column shown below.
The appDate field is a datetime column so I'm not sure if this is even possible. Any assistance would be appreciated.
SELECT dbo.dbAppointments.appID,
(case appAllDay when 0 then appDate else
****
end) as appTime
FROM
dbo.dbAppointments
WHERE dbo.dbAppointments.feeusri
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I don't deal with datetime in SQL very often so manipulation was new to me. I appreciate the sample and the SQL Server 08 notes.