We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

CASE command

Medium Priority
390 Views
Last Modified: 2012-05-11
How can I display different message based user input date? I have table field which holds date named completiondate. the field contains a date, null, or default date 1900:00:00:00. I want to give messaage 'Available' if user input date is greater than the completion date or null or default date and 'not available' if user input date is less than the completion date. How can I do it using case when statement?

thanks

ayha
Comment
Watch Question

CERTIFIED EXPERT

Commented:
do you want it in query

Create a store procedure , give the inputdata as paramenter
ex @indate

Select
Case
when @indate < completiondate then 'not available'
Else 'not available'

End

From tablename
Alpesh PatelSolution Architect at TCS (SAFe®Agilist, TOGAF® Foundation, PSM I®, MCP, MCSD)
CERTIFIED EXPERT

Commented:
Case when date is null then 'Message1' when date = '1900-01-01' then 'Message2' else 'Message3' End
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.