Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

FOR XML causing high cardinality in update statement.

$
0
0

Wasn't really sure how to word this, but here it goes. I have a simple update statement that uses a sub-query to concatenate a column from a record set using the most recently recommended fashion of FOR XML. The row estimations through the XML reader show as 42 million rows, but the actual rows are 18k'ish.

  update d
     set d.DraftDocumentReadyDate = stuff(isnull((select ', ' + convert(varchar, wa.WorkAudit_Date, 110)
                                                   from livelink.WAuditTrail wa inner join livelink.KUAF ku1 
                                                                                        on wa.WorkAudit_PerformerID_Name = ku1.Name
                                                  where d.VolumeID = wa.WorkAudit_WorkID
                                                    and wa.WorkAudit_Task_Title = 'Draft Document'  
                                                    and wa.WorkAudit_Status = 21
                                                for xml path (''), type).value('.','nvarchar(4000)'), ''), 1, 2, '')                                                                                                                                                                                                                                                      
    from #ltbl_DataDump d

Adding image of cardinality:


John M. Couch



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>