• danere (4/15/2012)


    Regarding the PRINT statement enhancement you suggested, I ran into an issue with truncation of result sets over 4000 characters in length. Any ideas how to get around this?

    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. If it can be more than limit then it gets more complicated as print always prints a line at a time, if a single column can be more than the limit, then it's more complicated -- something could be done with varbinary, but I don't have that worked out offhand. Basically varbinary can be easily split and joined together, but I'm not sure about the best general purpose solution in that case (if it's just one column at the end, it shouldn't be too difficult to do)...