sql-server-2019

SQL Query on Json object inside multiple JSON objects

你离开我真会死。 提交于 2020-05-14 09:00:07
问题 I have the below Json string. I need to write a query to get the TP records. Without providing the index value, we need get the result. { "S": [ { "Name": "Project1", "SP": [ { "ID": 1, "Name": "Test1", "TP": [ { "TID": 11, "TName": "TT1", }, { "TID": 12, "TName": "TT2", }, ] }, { "ID": 2, "Name": "Test2", "TP": [ { "TID": 13, "TName": "TT3", }, { "TID": 14, "TName": "TT4", }, ] }, ]}]} How do I query to get the TP values. Expected Result: TID TName 11 TT1 12 TT2 13 TT3 14 TT4 回答1: You can

Unexpected @@rowcount behavior inside an UDF in MS SQL 2019

时光总嘲笑我的痴心妄想 提交于 2020-01-23 01:39:06
问题 here's my sample code drop function rowcount_test go CREATE FUNCTION dbo.rowcount_test () RETURNS INT AS BEGIN DECLARE @v INT SELECT @v = 1 return @@ROWCOUNT END GO grant exec on dbo.rowcount_test to public go SELECT dbo.rowcount_test() It gives 1 when executed by mssql 2017 (and earlier) It gives 0 when executed by mssql 2019 It gives 1 when executed by mssql 2019 (Standard edition) with a db put to the 2017 compatibility mode It's never been a problem before... Is it a kind of setting

TDSParser: Encountered unexpected unknown token (0xA3)

馋奶兔 提交于 2020-01-16 08:43:37
问题 When calling some specific stored procedures using mssql-jdbc , I get an jdbc internal error in Java: Jan 02, 2020 8:11:32 AM com.microsoft.sqlserver.jdbc.TDSParser throwUnexpectedTokenException SCHWERWIEGEND: ConnectionID:5 ClientConnectionId: 30dcbc6e-ec5c-45ba-8801-1ecc549a0cd4: getNextResult: Encountered unexpected unknown token (0xA3) Jan 02, 2020 8:11:32 AM com.microsoft.sqlserver.jdbc.TDSReader throwInvalidTDSToken SCHWERWIEGEND: ConnectionID:5 ClientConnectionId: 30dcbc6e-ec5c-45ba