SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Learning about FOR JSON


Learning about FOR JSON

Author
Message
Site Owners
Site Owners
SSC Guru
SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)SSC Guru (60K reputation)

Group: Administrators
Points: 60857 Visits: 352
Comments posted to this topic are about the item Learning about FOR JSON
Deepak Sharma-2311
Deepak Sharma-2311
SSC Eights!
SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)SSC Eights! (923 reputation)

Group: General Forum Members
Points: 923 Visits: 496
I have recently used this feature and it was awesome. The only problem I have encountered to save the json data in file.
The output of json was large and when I tried to copy the data SQL doesn't allow me to copy. I follow the below steps:
Tools --> Options --> Query Results --> SQL Server --> Results to Text --> Maximum number of characters displayed in each column
Tools --> Options --> Results --> Maximum characters per column
After applying the above steps I was unable to save the data.
I tried to save the output by right clicking and save the data as file, but this break the json and when I validate it it failed and said - the document is not json format.

Then I used SSIS script task to use SQL query as a source to generate the output and save the results as .json. Which was perfect json.

Deepak Kumar Sharma
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search