If you are getting the following exception when running SPSiteDataQuery, you may want to check if you have any of the following three fields types in your <ViewFields> element.
- Lookup field
- Person or Group field
- a field called EventDate
The root cause for the above three fields is that the back-end query into SQL, that needs to return one than one columns for any of the three site fields(columns), is constructed to return a few more other columns from DB. However, the Nullable setting only mark one of the many fields into allowing NULL values. There is nothing we can do on # 1 or 2, but for #3, we will have to add a few more fields to avoid the problem.
<ViewFields>
<FieldRef Name="EventDate" Nullable="TRUE" />
<FieldRef Name="fAllDayEvent" Nullable="TRUE" />
<FieldRef Name="EndDate" Nullable="TRUE" />
<FieldRef Name="TimeZone" Nullable="TRUE" />
<FieldRef Name="XMLTZone" Nullable="TRUE" />
</ViewFields>