IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[myprint]') AND type = 'P')
DROP PROCEDURE [dbo].[myprint]
GO
CREATE procedure [dbo].[myprint](
@text nvarchar(MAX) 
)
as
begin
declare @m int
declare @i int , @j int
set @m =  len(@text) 
set @i = 1 
declare @t nvarchar(4000) 
declare @t1 nvarchar(4000) 
while (@text>'') 
begin
set @t = SUBSTRING(@text,1,1000) 
set @t1 = ''
if (LEN(@text)>1000) 
begin
set @text = SUBSTRING(@text,1001,len(@text)-1000) 
set @i = CHARINDEX(',',@text) 
set @j = CHARINDEX(' ',@text) 
if (@i<=0) set @i=@j  
if (@i>@j) set @i = @j  
if (@i>0) 
begin
set @t1 = SUBSTRING(@text,1,@i) 
set @text = SUBSTRING(@text,@i+1,len(@text)-@i) 
end 
end 
else set @text='' 
print  @t+@t1
end
end