ERROR:
An error occurred while executing batch. Error message is: Invalid attempt to GetBytes on column ‘xxx’. The GetBytes function can only be used on columns of type Text, NText, or Image.
EXPLANATION:
You may see an error message when you run a query against a table in a SQL Server database from SQL Server Management Studio.
SOLUTION:
In my case, the problem was to run a query that I ran against the SQL Server 2008 database from the 2005 version of SQL Server Management Studio. You must use a version of SSMS that is compatible with the version of the database that you are using.