如何在SQL Server 2008中将数据转换为json格式? [英] How to convert data to json format in SQL Server 2008?

查看:1432
本文介绍了如何在SQL Server 2008中将数据转换为json格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SQL Server 2008,并且想要将表数据转换为json格式.我可以通过触发查询直接将其转换吗?

I am using SQL Server 2008 and want to convert table data into json format. Can I convert it directly through firing query?

推荐答案

SQL Server 2016中添加了对格式化查询结果的格式支持,并将在Azure数据库中提供. 在旧版本中,您将需要使用CLR或一些繁重的TSQL,例如:

Built in support for formatting query results is added in SQL Server 2016 and it will be available in Azure Database. In older versions you would need to use CLR or some heavy TSQL like:

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆