INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How to write case statement

How to write case statement

(OP)
I'm trying to write a case statement in teradata.  So far I have:

CODE

Select.....

Case StartMinute
When Config.tblManagementUnit.TimeZone 'US/Central' then (StartMinute+60)
When Config.tblManagementUnit.TimeZone "US/Pacific" then (StartMinute+180)
When Config.tblManagementUnit.TimeZone "US/Mountain" then (StartMinute+120)
Else (StartMinute +0)
End

From....

Where...
Group by...
Having...
I get error 102 Incorrect syntax near 'Us/Central'.  I would like to add the appropriate number of minutes to a start time to convert them all to Eastern Standard time.  StartMinute is a column in one of the 4 tables I'm pulling from.   If I omit the case statement piece, the query works fine.  I've  tried using " instead of '.   I've tried using () instead of "", I've tried enclosing the "Startminute +" piece in single quotes, double quotes but it doesn't seem to help.

PS  I'm fresh off the boat new to SQL/Teradata.

 

RE: How to write case statement

I think you should use the '=' operator. like below

Case
When Config.tblManagementUnit.TimeZone = "US/Central" then (StartMinute+60)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close