我真的在MSSQL 2012中遇到了一個case語句。我已經四處尋找其他答案,但儘管我有一些幫助,但似乎沒有解決問題。帶有聚合和類似子句的case語句 - MSSQL 2012
case firstname
when len(ltrim(rtrim(firstname))) > 11 then 'blah'
else 'blahblah'
end as test
我得到一個語法錯誤,'>'字符。
原來,這是
case firstname
when ltrim(rtrim(firstname)) like '% %' then 'blah'
else 'blahblah'
end as test
,但我認爲有可能已經對類似的關鍵字一定的敏感性,所以我把它改爲「>」,但我得到了同樣的事情。
可能是一個愚蠢的問題,但我已經撞了我的頭幾個小時,一些見解將不勝感激。
啊,輝煌!這樣可行。非常感謝你! –
很快就會接受。 –