Can someone tell me why this simple Select Case is wrong. This is my first
attempt at this. I'm doing this on SQL 2005. Works fine until I try to do
a CASE.
SELECT Case Limit
When 'MKT' THEN 'MKT'
ELSE 'LMT'
FROM MoxyOrders
This is the error message.
Plamen Ratchev - 18 Jul 2008 20:16 GMT
You are missing the END part of CASE:
SELECT CASE Limit
WHEN 'MKT' THEN 'MKT'
ELSE 'LMT'
END
FROM MoxyOrders
HTH,
Plamen Ratchev
http://www.SQLStudio.com
Steve Kass - 18 Jul 2008 20:17 GMT
You forgot to end the CASE expression with the keyword END.
CASE ...
END
Steve Kass
Drew University
http://www.stevekass.com
>Can someone tell me why this simple Select Case is wrong. This is my first
>attempt at this. I'm doing this on SQL 2005. Works fine until I try to do
[quoted text clipped - 8 lines]
>
>
pvong - 18 Jul 2008 20:20 GMT
Forgot to paste the error. This is it.
Missing or incomplete SELECT clause.
Unable to parse query text.
> Can someone tell me why this simple Select Case is wrong. This is my
> first attempt at this. I'm doing this on SQL 2005. Works fine until I
[quoted text clipped - 6 lines]
>
> This is the error message.
SQL Menace - 18 Jul 2008 20:20 GMT
You need to add END
SELECT Case Limit
When 'MKT' THEN 'MKT'
ELSE 'LMT' END AS Limit
FROM MoxyOrders
Denis The SQL Menace
http://www.lessthandot.com/
http://sqlservercode.blogspot.com
http://sqlblog.com/blogs/denis_gobo/default.aspx
> Can someone tell me why this simple Select Case is wrong. This is my first
> attempt at this. I'm doing this on SQL 2005. Works fine until I try to do
[quoted text clipped - 6 lines]
>
> This is the error message.
pvong - 18 Jul 2008 20:27 GMT
Thanks everyone!!!
> Can someone tell me why this simple Select Case is wrong. This is my
> first attempt at this. I'm doing this on SQL 2005. Works fine until I
[quoted text clipped - 6 lines]
>
> This is the error message.