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 |
|
vbjohn
Starting Member
32 Posts |
Posted - 2005-10-11 : 11:40:18
|
| Can someone tell me what I am doing wrong. I am trying to test this out by using the Print Statement.It is telling me:Error 156: Incorrect syntax near the keyword 'CASE'/Incorrect syntax near the keyword 'END'.CASE @TType WHEN 'U' THEN Print 'U' WHEN 'I' THEN Print 'I' WHEN 'D' THEN Print 'D'END |
|
|
SreenivasBora
Posting Yak Master
164 Posts |
Posted - 2005-10-11 : 11:55:18
|
| declare @TType varchar(1), @TType1 varchar(1)set @TType = 'I'select @TType1 = CASE @TType WHEN 'U' THEN 'U' WHEN 'I' THEN 'I' WHEN 'D' THEN 'D' ENDPrint @TType1With RegardsBSR |
 |
|
|
vbjohn
Starting Member
32 Posts |
Posted - 2005-10-11 : 11:59:59
|
| Awesome thanks. |
 |
|
|
Sitka
Aged Yak Warrior
571 Posts |
Posted - 2005-10-11 : 16:52:06
|
| [code]declare @TType varchar(1)set @TType = 'I'select CASE @TType WHEN 'U' THEN 'U' WHEN 'I' THEN 'I' WHEN 'D' THEN 'D' END as colTTypedeclare @TType varchar(1)set @TType = 'J'select CASEWHEN @TType = 'U' THEN 'U' WHEN @TType = 'I' THEN 'I' WHEN @TType = 'D' THEN 'D'ELSE 'whatdoyado'END as colTType[/code]two other stylesI wish someone would start an Official XML Rant Thread. |
 |
|
|
|
|
|