September 17, 2018 at 7:24 am
Hi
I have this View with these fieldsSELECT FisrtName
,LastName
,IDNumber
,Address1
,Address2
,Address3
,FileType
FROM myView
When I execute this view I get all the 7 fields back,
However when I execute this JSON query below, there are records that are coming back with only 3 fields back: LastName, Address3 and FileType, not all 7 fields, but there are also records where I get all 7 fields. Anybody knows why that's the case?SELECT CA.PartnerBankingAdditionalAttributes
FROM RltView.ActiveAndInactiveMembersPaymentDetails_V OV WITH (NOLOCK)
CROSS
APPLY (
SELECT FisrtName
,LastName
,IDNumber
,Address1
,Address2
,Address3
,FileType
FROM (VALUES(1))DT(x)
FOR JSON AUTO, WITHOUT_ARRAY_WRAPPER
) CA (PartnerBankingAdditionalAttributes)
WHERE OV.IsActive = 1
AND isPaid = 'Y'
September 17, 2018 at 7:42 am
Are any of those columns having NULL values?
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
September 17, 2018 at 11:04 pm
sgmunson - Monday, September 17, 2018 7:42 AMAre any of those columns having NULL values?
I would to believe so
September 18, 2018 at 12:35 am
sgmunson - Monday, September 17, 2018 7:42 AMAre any of those columns having NULL values?
Yes some are.
September 18, 2018 at 6:21 am
Have you tried adding the INCLUDE_NULL_VALUES option ?
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
September 18, 2018 at 6:24 am
sgmunson - Tuesday, September 18, 2018 6:21 AMHave you tried adding the INCLUDE_NULL_VALUES option ?
No, I'll google it and see how to do it, thank you.
September 18, 2018 at 6:42 am
September 20, 2018 at 8:31 pm
It's worth noting that, because of the dynamic nature of JavaScript, it's typical to assume a "missing" field and a null field are equivalent and most systems would expect there to be no discernible difference (and in that case it is usually preferable to omit fields because it produces less verbose JSON).
September 21, 2018 at 4:08 pm
This was removed by the editor as SPAM
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply