我不认为你可以在MSSQL7中使用varchar(MAX),所以这里会给你所有数据(注意,我理解的是你只是想看到数据,你不会放它在变量中或返回它).
因此,这将打印整个字符串,以便您可以直观地看到字段中的内容:
DECLARE @limit as int, @charLen as int, @current as int, @chars as varchar(8000) SET @limit = 8000 SELECT TOP 1 @charLen = LEN(text) FROM myTable SET @current = 1 WHILE @current < @charLen BEGIN SELECT TOP 1 @chars = SUBSTRING(text,@current,@limit) FROM myTable PRINT @chars SET @current = @current + @limit END