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

推荐订阅源

L
LINUX DO - 热门话题
Stack Overflow Blog
Stack Overflow Blog
B
Blog
WordPress大学
WordPress大学
Project Zero
Project Zero
P
Palo Alto Networks Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
T
Tailwind CSS Blog
Forbes - Security
Forbes - Security
F
Full Disclosure
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hacker News: Ask HN
Hacker News: Ask HN
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
Cisco Talos Blog
Cisco Talos Blog
G
Google Developers Blog
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recorded Future
Recorded Future
O
OpenAI News
Spread Privacy
Spread Privacy
MongoDB | Blog
MongoDB | Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
Cybersecurity and Infrastructure Security Agency CISA
S
Securelist
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
IT之家
IT之家
U
Unit 42
腾讯CDC
S
Security Affairs
C
Cisco Blogs
Schneier on Security
Schneier on Security
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
宝玉的分享
宝玉的分享
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss

博客园 - 卡车司机

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天免费试用期, 哈哈.