When ever we are running a query in management studio , there is a chance to get this error , if the query result set is too big, and more than 2 GB in size.
To resolve this error , Right click on Query window configure the query result to either file or text.

