Celtic Coding Solutions Blog

Celtic Coding Solutions Blog - for everything computer related

SQL Server error "Invalid attempt to GetBytes" on T-SQL queries

Whilst trying to do a simple query in Microsoft SQL Server Management Studio e.g.

SELECT TOP 10 * FROM dbo.DatabasePerInstance

I was getting the following error:-

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

Thought it was a bit strange as is a really basic type of T-SQL.  However I running Management Studio 2005 and this SQL Server I was connecting to was SQL Server 2008 r2.

Fix

Run the same version or higher Microsoft SQL Server Management Studio to do the T-SQL.  Once I loaded up 2014 Management Studio no more errors.

Comments are closed