question

isteyakahmad-5434 avatar image
0 Votes"
isteyakahmad-5434 asked COZYROC answered

Import text File having data in Json format and load into SQL server

Hi Team,

I need to created an import package in SSIS to load data from text file which is having content in json format and load into Sql server database.


Below is one sample record in text file :


{"apeId":"677ac547367456defgea42beb9bebc","apeName":"DISCOVERY STATION","id":"e1a3af5af654178a0ff5ffc01fd014a7","imageUrl":"http://172.16.6.9:8080/427/21e3698fd99ffb5c.jpg","lat":"25.038544","lng":"52.146149","monitorTask":"Traffic","resultTime":"2021-03-26 16:05:25","sceneImgUrl":"http://172.16.6.9:8080/427/21e3d99ffb5c.jpg","subType":"CAR","subjectId":"H66621","trackId":"329741647"}

I need to get only the value from this and load into sql, the key is my table column name.
Understand it can be done through script task.
Please assist me on code sample.

Thanks,
Isteyak Ahmad

sql-server-integration-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Zoehui-MSFT avatar image
0 Votes"
Zoehui-MSFT answered

Hi @isteyakahmad-5434,

Code writing is out of my ability.

I did some online research for you which you may take a reference to see if it is useful.

Convert JSON to DataTable

how-to-import-json-data-in-sql-server-using-mvc-5

importing-json-files-using-sql-server-integration-services

Regards,

Zoe


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues October


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

COZYROC avatar image
0 Votes"
COZYROC answered

T-SQL has included support for JSON data since SQL Server 2016. For further information, please check the documentation page here.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.