How to load JSON file to SQL Server?

Published: 03 July 2022
on channel: Coding Studio
17,076
213

Demonstrates how JSON document can be loaded to SQL Server.

T-SQL SCRIPT:

declare @json_data varchar(max)

select @json_data = BulkColumn
from openrowset
(
BULK 'C:\temp\test.json', SINGLE_CLOB
) as datasource

--print @json_data

insert into emp (emp_name, emp_address,phone, age)
select Name, Address, Phone, Age from openjson (@json_data)
WITH
(
Name varchar(20),
Address varchar(20),
Phone varchar(20),
Age int
)
select * from emp

Hope, it was helpful.
Thanks you!

Next video:
Convert JSON to CREATE TABLE Statements

#json
#sqlservertutorial
#sqlserver
#sqlservermanagementstudio


Watch video How to load JSON file to SQL Server? online without registration, duration hours minute second in high quality. This video was added by user Coding Studio 03 July 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 17,076 once and liked it 213 people.