Got the above obscure error message whilst dynamically generating and then executing a case statement where I was casting the fields to varchar using:
'when ''' + c.[name] + ''' then cast(a1.' + c.[name] + ' as varchar)',
The above code was working fine until the column that had been added was a GUID.
Solution:
Simple, specify the length of the varchar! Now works fine..
'when ''' + c.[name] + ''' then cast(a1.' + c.[name] + ' as varchar(40))',
No comments:
Post a Comment