Fixed SqlServer issue with cas