You are here: Case Statement in Where Clause « MsSQL Server « IT news, forums, messages
Case Statement in Where Clause

Posted by paulmac106 on 10/12/06 21:50

If you could help me with my syntax i would really appreciate
it. I'm trying to change the where clause on the fly, but it's
giving me a syntax error.

Hopefully from what I have below you can tell what i'm after

the first part should evaluate a boolean expression, then if true,
search using one field, otherwise
search using a different field

WHERE

Case WHEN @myCompany = 933
THEN tblClient.companycode = 933 --problem line
ELSE
tblCase.clientcode = @myClient --problem line
END

And tblCase.status = 'Active'

thank you!!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация