GPH
GPH

Reputation: 1897

Case when LEN > 10

Afternoon All,

I'm currently trying to write a case when statement that replaces anything over 12 characters as a '' . Cant seem to get the right syntax and wondered if anyone has any pointers?

CASE WHEN Field1 = LEN(Field1) >12 THEN '' ELSE Field1 END

Thanks

Upvotes: 0

Views: 8987

Answers (1)

siride
siride

Reputation: 209615

Get rid of the Field1 = part right after the WHEN (the part between WHEN and THEN must be a boolean expression ONLY). I'm guessing you want that outside the CASE expression altogether since you can't do assignments inside a CASE expression.

Field1 = CASE LEN(Field1) > 12 THEN '' ELSE Field1 END

Upvotes: 4

Related Questions