Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
beyonder422
Posting Yak Master
124 Posts |
Posted - 2006-02-06 : 11:58:55
|
| Can anyone tell me why I'm getting a data type conversion (error listed below code) on this "Order by" operation?declare @order_by char(5)set @order_by = 'ASSBY'select consumed_date (datetime), part_id1 (varchar 20), part_id2 (varchar 20)from consumed_parts cp with(nolock)order by (CASE @order_by WHEN 'ASSBY' THEN part_id1) WHEN 'RAWPP' THEN part_id2 ELSE consumed_date END)Server: Msg 241, Level 16, State 1, Line 26Syntax error converting datetime from character string.I've tried doing a convert to varchar on all and it works but then the date sort isn't correct.Anyone ever dealt with this before?www.beyonder422.com |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
|
|
beyonder422
Posting Yak Master
124 Posts |
Posted - 2006-02-06 : 17:27:05
|
| that article was what I was looking for.thanxwww.beyonder422.com |
 |
|
|
|
|
|