Code Project

Link Unit

Monday, May 28, 2012

Error: The GetBytes function can only be used on columns of type Text, NText, or Image

On running a simple statement like

Select * from TableABC

and following error was encountered.

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

Reason:
After we checked the version of SSMS we noticed that connecting to the 2008 instance with a 2005 SSMS client was the issue. Essentially it means that SSMS doesn't understand one of the column data types coming back to it like datetime2

Solution:
Connected with SSMS 2008 and it all worked again.

Post a Comment