Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL 2008 query result message tab display limit Expand / Collapse
Author
Message
Posted Tuesday, October 05, 2010 6:02 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, March 30, 2011 12:09 AM
Points: 10, Visits: 29
Hi All,

I need to print the message more than 8000 characters. But sql server 2008 can't support more than 8000 characters. It's allowing and display only 8000 characters alone.

Can you please anyone tell me how to change this limitations?

Sample query:
Print(REPLICATE('1',8005))

This query returns only 8000 single ones like (11111...), but it should be display 8005 single ones.

Thanks & Regards,
Sathiskumar.P
Post #998255
Posted Tuesday, October 05, 2010 6:12 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 11, 2014 1:11 AM
Points: 206, Visits: 756
The replicate command truncate to 8000 characters if you are not using varchar(max) or nvarchar(max).

If you use varchar(max) it works fine though:
select len(replicate(convert(varchar(max),1),8005))

Output: 8005
Post #998261
Posted Tuesday, October 05, 2010 6:19 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, March 30, 2011 12:09 AM
Points: 10, Visits: 29
No, I want to display 8005 single ones (111111111111.....) in query result message tab and I have not problem for display the 8005 count.

Sample query:
Print(REPLICATE('1',8005))

This query returns only 8000 single ones in the query result message tab like (11111...), but it should be display 8005 single ones in that message tab not count.

Thanks & Regards,
Sathiskumar.P
Post #998266
Posted Tuesday, October 05, 2010 6:56 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Saturday, March 15, 2014 4:31 AM
Points: 2,808, Visits: 7,173

This query returns only 8000 single ones in the query result message tab like (11111...), but it should be display 8005 single ones in that message tab not count.



You wont be able to display more than 8000 characters with PRINT no matter how much you want to

read the PRINT specs here , max is 8000 non unicode chars
http://msdn.microsoft.com/en-us/library/ms176047.aspx

Also this is a strange request, why would you want to do this?
Post #998294
Posted Tuesday, October 05, 2010 8:14 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, February 18, 2013 3:46 AM
Points: 1,422, Visits: 1,883
You can use this procedure http://www.sqlservercentral.com/scripts/Print/63240/ to print out your data in chunks of 8000...I've used it in the past to debug dynamic SQL statements that way exceed 8000 characters and which fail at some obscure point(yep - that was fun)

DECLARE @Max varchar(max);
SET @Max = REPLICATE('X',8000);
SET @Max = @Max+'----This will not show up in PRINT';
PRINT @Max
PRINT CHAR(13)+CHAR(13)
PRINT REPLICATE('*',30)
EXEC dbo.LongPrint @Max




Post #998382
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse