sql - Case statement with aggregate and like clause - MSSQL 2012 -
i'm struggling case statement in mssql 2012. i've looked around other answers, although i've got help, none seem fix problem.
case firstname when len(ltrim(rtrim(firstname))) > 11 'blah' else 'blahblah' end test
i getting syntax error, on '>' character.
originally,
case firstname when ltrim(rtrim(firstname)) '% %' 'blah' else 'blahblah' end test
but thought there may have been sensitivity on keyword, changed '>', same thing.
probably dumb question, i've been banging head couple of hours , insight appreciated.
try version:
(case when len(ltrim(rtrim(firstname))) > 11 'blah' else 'blahblah' end) test
the case
statement has 2 versions. 1 variable used constant expressions:
(case firstname when 'arnold' . . . when 'betty' . . . end)
the second version (which 1 use) takes conditional each part:
(case when firstname = 'arnold' . . .
Comments
Post a Comment