I am not familiar with importing JSON files. I received the code below to import a JSON file but I do not know where to find the data once it is imported? Can someone tell me where the file would be imported to, like the table name from the code? Thanks.
DECLARE @JSON varchar(max)
SELECT @JSON = BulkColumn
FROM OPENROWSET (BULK 'C:\SQL\Walt\ClientReportData_02172024_012817.json', SINGLE_CLOB) import
SELECT *
FROM OPENJSON (@JSON)
WITH (
--Company:
CompanyKey_Company varchar (255) '$.Company.CompanyKey'
,CompanyName varchar (255) '$.Company.CompanyName'
,EIN varchar (255) '$.Company.EIN'
,MaNumber varchar (255) '$.Company.MaNumber'
,ServiceLocation varchar (255) '$.Company.ServiceLocation'
,ProcJson NVARCHAR(MAX) '$.Procedures' AS JSON
) AS oj
OUTER APPLY
OPENJSON(oj.ProcJson)
WITH
(
--Procedures:
,CompanyKey_Proc varchar (255) '$.CompanyKey'
,ClientKey_Proc varchar (255) '$.ClientKey'
,ClaimKey_Proc varchar (255) '$.ClaimKey'
,ProcedureCode varchar (255) '$.ProcedureCode'
,PlaceOfService varchar (255) '$.PlaceOfService'
,FundingType varchar (255) '$.FundingType'
,IsResidential varchar (255) '$.IsResidential'
,CostCenter varchar (255) '$.CostCenter'
,DenialCode varchar (255) '$.DenialCode'
,UnitOfMeasure varchar (255) '$.UnitOfMeasure'
,PaidUnits varchar (255) '$.PaidUnits'
,Rate varchar (255) '$.Rate'
)
select * into someTableName FROM OPENJSON (@JSON) ... rest of the code
CREATE TABLE
with some pre-defined columns, thenINSERT YourTable (ColumnsHere) SELECT ...