How to load JSON file to SQL Server?

preview_player
Показать описание
Demonstrates how JSON document can be loaded to SQL Server.

T-SQL SCRIPT:

declare @json_data varchar(max)

select @json_data = BulkColumn
from openrowset
(
) as datasource

--print @json_data

insert into emp (emp_name, emp_address,phone, age)
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
Рекомендации по теме
Комментарии
Автор

I get the below error - Msg 4861, Level 16, State 1, Line 2
Cannot bulk load because the file "C:\temp\json\1.json" could not be opened. Operating system error code 5(Access is denied.).

sushanthireddy
Автор

Can you please help me with the below error. Msg 4860, Level 16, State 1, Line 2
Cannot bulk load. The file "C:\temp\json\1.json" does not exist or you don't have file access rights.

sushanthireddy
Автор

How to write the Json Output in powerShell to SQL Server Table

kishanbhise
Автор

This didn't work for me. Shows all the fields as NULL

codewithreen
Автор

Thanks, very handy share. Subscribed.

drivetrainerYT
Автор

How can we get JSON file from azure blob?

guggilamdivyasai