I'm trying to build a string that shows a list of materials not charged to a job. Problem I'm running into is that it seems to be cutting off the string after 255 characters. I know it should be able to hold more than this, what am I doing wrong?DECLARE @jobmatls VARCHAR(MAX)SET @jobmatls = 'Materials have not been issued to the job:' + CHAR(13)DECLARE db_cursor CURSOR FORSELECTitem,CAST(dbo.ReqQty(@jobqty, Units, Matl_Qty, 1, 0) - qty_issued AS DECIMAL(4,2))FROM jobmatlWHERE jobmatl.job = @job AND dbo.ReqQty(@jobqty, Units, Matl_Qty, 1, 0) - qty_issued > 0DECLARE @item dbo.ItemTypeDECLARE @qtyreq NVARCHAR(6) OPEN db_cursorFETCH NEXT FROM db_cursor INTO @item, @qtyreq;WHILE @@FETCH_STATUS = 0 BEGIN SET @jobmatls = @jobmatls + @item + ': ' + @qtyreq + ' pc(s)' + CHAR(13)FETCH NEXT FROM db_cursor INTO @item, @qtyreq; END CLOSE db_cursor DEALLOCATE db_cursorSELECT @jobmatls
Result:Materials have not been issued to the job:23992: 1.00 pc(s)23869: 1.00 pc(s)23993: 1.00 pc(s)13042: 1.00 pc(s)27966: 1.00 pc(s)18220-603S: 8.00 pc(s)18100-076C: 3.00 pc(s)27123-1: 1.00 pc(s)13051: 2.00 pc(s)18100-611B: 4.00 pc(s)18110-025T: 4.00