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 |
|
Hakuzen
Starting Member
24 Posts |
Posted - 2009-05-28 : 12:37:28
|
Hello all, sorry if this request seems dumb but I'm having syntax problems with an update statement.Update #MultiTicket Set Color = Case When MultiTicket = 1 then Red When DisplayOn = 1 and (Code = 'I' or Code = 'IA') and CallBackDone = 0 then "Light Green"When DisplayOn = 1 and (Code = 'I' or Code = 'IA') and CallBackDone <> 0 then "Dark Green" When DisplayOn = 1 and (Code = 'R' or Code = 'RW') and CallBackDone = 0 then "Light Orange" When DisplayOn = 1 and (Code = 'R' or Code = 'RW') and CallBackDone <> 0 then "Dark Orange"When DisplayOn = 1 and Code = 'Unavailable' then "Gray"When DisplayOn = 1 and Code = 'TS' then "Pink" When DisplayOn = 1 and Code = 'T' then "Blue"When DisplayOn = 1 and CallBackDone = 0 then "Light Yellow"When DisplayOn = 1 and CallBackDone <> 0 then "Dark Yellow" Would anyone be willing to help me out? When I add that snippet of code to my Sproc it says the syntax error is on a line independant of that code, not sure if it means anything. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-28 : 12:42:33
|
| [code]Update #MultiTicket Set Color = Case When MultiTicket = 1 then 'Red' When DisplayOn = 1 and (Code = 'I' or Code = 'IA') and CallBackDone = 0 then 'Light Green'When DisplayOn = 1 and (Code = 'I' or Code = 'IA') and CallBackDone <> 0 then 'Dark Green' When DisplayOn = 1 and (Code = 'R' or Code = 'RW') and CallBackDone = 0 then 'Light Orange' When DisplayOn = 1 and (Code = 'R' or Code = 'RW') and CallBackDone <> 0 then 'Dark Orange'When DisplayOn = 1 and Code = 'Unavailable' then 'Gray'When DisplayOn = 1 and Code = 'TS' then 'Pink' When DisplayOn = 1 and Code = 'T' then 'Blue'When DisplayOn = 1 and CallBackDone = 0 then 'Light Yellow'When DisplayOn = 1 and CallBackDone <> 0 then 'Dark Yellow'[/code] |
 |
|
|
Hakuzen
Starting Member
24 Posts |
Posted - 2009-05-28 : 12:57:56
|
| Hello Vis,I plugged in your changes and it changed my syntax error to"near 'dark yellow'"Thanks again for the help!^^ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-28 : 13:11:09
|
missed an endUpdate #MultiTicket Set Color = Case When MultiTicket = 1 then 'Red' When DisplayOn = 1 and (Code = 'I' or Code = 'IA') and CallBackDone = 0 then 'Light Green'When DisplayOn = 1 and (Code = 'I' or Code = 'IA') and CallBackDone <> 0 then 'Dark Green' When DisplayOn = 1 and (Code = 'R' or Code = 'RW') and CallBackDone = 0 then 'Light Orange' When DisplayOn = 1 and (Code = 'R' or Code = 'RW') and CallBackDone <> 0 then 'Dark Orange'When DisplayOn = 1 and Code = 'Unavailable' then 'Gray'When DisplayOn = 1 and Code = 'TS' then 'Pink' When DisplayOn = 1 and Code = 'T' then 'Blue'When DisplayOn = 1 and CallBackDone = 0 then 'Light Yellow'When DisplayOn = 1 and CallBackDone <> 0 then 'Dark Yellow'END |
 |
|
|
|
|
|