惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 【当耐特】
Help Net Security
Help Net Security
P
Proofpoint News Feed
J
Java Code Geeks
爱范儿
爱范儿
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Full Disclosure
Google DeepMind News
Google DeepMind News
H
Help Net Security
G
Google Developers Blog
Jina AI
Jina AI
Vercel News
Vercel News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
Lohrmann on Cybersecurity
S
Schneier on Security
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
Security Archives - TechRepublic
Security Archives - TechRepublic
阮一峰的网络日志
阮一峰的网络日志
N
News and Events Feed by Topic
GbyAI
GbyAI
B
Blog
O
OpenAI News
博客园_首页
Cisco Talos Blog
Cisco Talos Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hacker News: Ask HN
Hacker News: Ask HN
TaoSecurity Blog
TaoSecurity Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
M
MIT News - Artificial intelligence
C
Cybersecurity and Infrastructure Security Agency CISA
Cyberwarzone
Cyberwarzone
Webroot Blog
Webroot Blog
Simon Willison's Weblog
Simon Willison's Weblog
Y
Y Combinator Blog
C
Cisco Blogs
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
AI
AI
W
WeLiveSecurity
aimingoo的专栏
aimingoo的专栏
The Register - Security
The Register - Security
Project Zero
Project Zero
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
Netflix TechBlog - Medium
Blog — PlanetScale
Blog — PlanetScale

博客园 - 卡车司机

macOS系统下修改hosts文件,安装homebrew & nvm How to see log files in MySQL? git 设置和取消代理 使用本地下载和管理的免费 Windows 10 虚拟机测试 IE11 和旧版 Microsoft Edge windows 10 x64系统下在vmware workstation pro 15安装macOS 10.15 Catelina, 并设置分辨率为3840x2160 在Windows 10系统下将Git项目签出到磁盘分区根目录的方法 群晖NAS(Synology NAS)环境下安装GitLab, 并在Windows 10环境下使用Git windows 10 专业版安装VMware虚拟机碰到的坑 PDF.js实现个性化PDF渲染(文本复制) Java平台下利用aspose转word为PDF实现文档在线预览 Razor Page Library:开发独立通用RPL(内嵌wwwroot资源文件夹) 杂记 Code First Migrations in Team Environments SQL Server UPDATE JOIN visual studio 使用正则表达式实现代码批量查找和替换 AngularJs - Calling Directive Method from Controller Entity Framework Power Tools 执行数据库反向工程时报错.... SVN-无法查看log,提示Want to go offline,时间显示1970问题 windows server安装dotnet-sdk-2.2.108-win-x64.exe时报dll找不到
在Microsoft SQL SERVER Management Studio下如何完整输出NVARCHAR(MAX)字段或变量的内容
卡车司机 · 2020-10-19 · via 博客园 - 卡车司机

2020-10-19 10:10  卡车司机  阅读(466)  评论()    收藏  举报

DECLARE @ResponseText nvarchar(max)
DECLARE @PageSize int
DECLARE @Counter INT
DECLARE @TotalPrints INT
DECLARE @Length int;

SET @PageSize = 2;
SET @Counter = 0
SET @ResponseText = '123456789'
SET @Length = LEN(@ResponseText)

IF((@Length % @PageSize) = 0)
    BEGIN
        SET @TotalPrints = (@Length / @PageSize)
    END
ELSE
    BEGIN
        SET @TotalPrints = (@Length / @PageSize) + 1
    END

WHILE @Counter < @TotalPrints 
    BEGIN
        PRINT SUBSTRING(@ResponseText, (@Counter * @PageSize)+1, @PageSize)
        SET @Counter = @Counter + 1
    END

第一步: 将需要输出的内容存入@ResponseText变量, 并执行上述代码

第二步: 由于PRINT函数打印出来的内容最后会加一个回车换行符, 需要使用工具软件替换掉.

  我这里使用Visual Studio来处理, 先在Visual Studio里新建一个文本文档, 将打印出来的字符串全部复制到刚才新建的文本文档里. 然后使用Visual Studio的查找和替换功能, 记得要选中"使用正则表达式"选项, 点击"替换"按钮, 完成

还有一个更简单的办法, 可以使用Navicat这个软件, 查询出来的NVARCHAR(MAX)字段内容已经是完整的内容, 但是Navicat不是免费软件, 购买商业版永久许可证11,129.00. 好在他有14天免费试用期, 哈哈.