0

I have a view with 998 columns*, and running a SELECT A.* FROM this view works, albeit relatively slowly (i.e. SELECT A.* FROM [MyView] A).

When I run a second query that returns the same columns but joining to a separate table to filter some rows out, I get the error message:

Cannot create a row of size 8061 which is greater than the allowable maximum row size of 8060.

This is the query that throws the error:

SELECT
    A.HOSPITAL_NAME
FROM 
    HReportBuilderView A
JOIN 
    HospitalNameLookup B ON A.DEFINITIVE_ID = B.HOSPITAL_ID 

Admittedly, my knowledge on bytes is shallow, but I suppose my question is: if the number of columns/columns themselves are identical, why is this throwing an error message when a simple select * from that view does not?

* Believe it or not, there is an actual business reason to have a view of 998 columns, so hopefully the stack overflow community will cut me some slack.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
bcoakley
  • 15
  • 3
  • Possible duplicate of [Entity Framework - Row size greater than allowable maximum row size of 8060](https://stackoverflow.com/questions/7631546/entity-framework-row-size-greater-than-allowable-maximum-row-size-of-8060) – Fleury26 Dec 15 '17 at 20:51
  • when you add the join the execution plan presumably contains an operator such as a sort or hash join that tries to write the rows to a work table. – Martin Smith Dec 15 '17 at 21:20

0 Answers0