switch update sql to use substr