Sql server 2016 新语法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_41600552/article/details/82958906

目前还没使用到很多,以后或慢慢新增

1. 把查出来的表数据转换成json包

select * from [dbo].[FinancialCreditCarApplyHeader]
for json auto

2。SQL With As 用法

with  cr as 

    select CountryRegionCode from person.CountryRegion where Name like 'C%' 
)

select * from person.StateProvince where CountryRegionCode in (select * from cr)

这相当于一个语句块的编写适合用于函数中返回表结构,这个用法好比试图,多表连接

猜你喜欢

转载自blog.csdn.net/weixin_41600552/article/details/82958906