Skip to content
Advertisement

Case expressions may only be nested to level 10

I have the following code for handling phone numbers such as country code for Australia +61, 61, 001161 etc. The problem that I have I can’t insert any CASE statement anymore under: CASE WHEN LEFT(@BPartyNo, 4) = '+610'

It said that Case expressions may only be nested to level 10

How do I streamline this TSQL so I can put more CASE?

Advertisement

Answer

They don’t need to be nested at all:

Personally, I would restructure your code so that you make sure the data in sanitized upon input, rather than trying to sanitize it now (when it’s clearly too late…). Or at least do the conversion in your client language (i.e. in whatever is calling this sproc), which is hopefully more suited to the task of string manipulation than T-SQL is.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement