Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Case Statement Help
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00759711
Message ID:
00759727
Views:
20
This message has been marked as the solution to the initial question of the thread.
Kirk,

It should be
	MinutesInAdvanceCancelled=
		CASE 
		WHEN datediff(minute,canceldate,begintime) < 0 THEN 0
		ELSE datediff(minutes,canceldate,begintime)
		END
>Below is the query SP I'm trying to write. I need to determine how many minutes in advance a case was cancelled. The system stores the Begintime as the scheduled start of a case. The canceldate field hold the datetime it was cancelled. Sometimes cases are cancelled after the scheduled start time (begintime), these I want to return as a zero. Otherwise, I want to return the number of minutes that the case was cancancelled before it's original begin time.
>
>I can't figure out the write way to use the case. I keep getting an error message on the > portion of the statement.
>
>Thanks for any help.
>
>Kirk
>
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform