A case switch might be cleaner here, but it's just a matter of style. Similar style point - it took me a while to notice the multiple returns so at first glance I thought you were always returning VARCHAR(128). No big deal, just a comment.