Quick troubleshooting post. Given this error from a colleague upon execution of a pretty simple function that used a DATE column:
An error occurred while executing batch. Error
message is: Invalid attempt to GetBytes on column 'RelDate'. The GetBytes
function can only be used on columns of type Text, NText, or Image.
I couldn't reproduce the problem on my machine - the same function worked fine for me. Checked all his query execution settings and didn't see anything, and then he realized he was running SQL Management Studio 2005 connected to a 2008 R2 instance. As soon as he fired up SMS 2008 R2, the function worked fine.