Link to home
Start Free TrialLog in
Avatar of smsstech
smsstechFlag for Canada

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.feeusrid = 7459
ASKER CERTIFIED SOLUTION
Avatar of tlovie
tlovie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smsstech

ASKER

Thanks.  Fantastic work.

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.