• danere (4/17/2012)


    john.moreno (4/16/2012)

    The problem is that PRINT can only print 4000/8000 characters (depending upon whether it is varchar or nvarchar), so the solution depends upon your data.

    If all of the textual representation of the data in a single row will always fit within the limit, it's easy enough to loop over the results, printing out one line at a time.

    I think for most cases a 4000/8000 character limit per row isn't going to be an issue (none of the tables I have come close to this). I'll take a look at incorporating a loop to print it out each row separately as you suggested.

    Btw I just noticed that there is a "Maximum number of characters displayed in each column" setting in SSMS, which is limited to 8192 characters. Not sure how this might affect the varbinary solution you mentioned (?).

    It doesn't matter for the varbinary solution as that is using PRINT, what it means is that your original solution would fail when the textual representation of a row is more than 8,192 characters (the row would get truncated). Basically it's slightly more than PRINT solution that does it row by row.