This is just a quick post in case you run into this problem. This is an interesting error and it had a coworker worry about table corruption. This coworker connected to a database on a fairly new server, he then executed a query like the following

T-SQL
1
2
SELECT *
FROM SomeTable
SELECT *
FROM SomeTable

And here is the error message he got

An error occurred while executing batch. Error message is: Invalid attempt to GetBytes on column ‘BookDate’.
Error: The GetBytes function can only be used on columns of type Text, NText, or Image.

Then I decided to run the same query from my machine and it all worked without a problem. From here it is pretty easy since the problem must be with the client software. And after we checked the version of SSMS we noticed that he connected to the 2008 instance with a 2005 SSMS client. He then connected with SSMS 2008 and it all worked again. What is interesting is that if you use Query Analyzer then you don’t get an error and it just works

Lesson learned…it is not the server..it is you!

*** Remember, if you have a SQL related question, try our Microsoft SQL Server Programming forum or our Microsoft SQL Server Admin forum