Print Max query in sql

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Print Max query in sql



How to print dynamic query that contains more than 8000 chars.


Declare @sql varchar(max)
set @Qry='....(more than 8000 char)'
Print (@Qry)



Any help?



Thanks.





Print (CAST(@Qry as TEXT))
– Tapakah Ua
10 mins ago





varchar(max) can store up to 2gb ....
– JeffUK
7 mins ago




1 Answer
1



Just do it, varchar(max) can hold upto 2gb. E.g.


declare @test varchar(max);
declare @loop int = 1;
set @test= 'select ''1000000000000000000000000000000000000000000''';

while @loop < 1001
begin
set @test = @test + ',''1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000''';
set @loop = @loop + 1;
end;

select len(@test);
exec(@test);



len(@test) is around 100,000 characters, exec works as expected.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived