tag:blogger.com,1999:blog-2379842053067321961.post8913398048876560575..comments2024-03-29T05:42:54.961-07:00Comments on Welcome To TechBrothersIT: How to Load Multiple JSON Files to SQL Server Table with File Name In SSIS - SSIS Tutorial 2021Aamir Shahzadhttp://www.blogger.com/profile/16777994869678463807noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-2379842053067321961.post-73174038535580624822022-10-03T09:50:29.858-07:002022-10-03T09:50:29.858-07:00I figured this out. Im not using the filename in m...I figured this out. Im not using the filename in my DB, yet I had it in the second SELECT statement. removed it and everything works :)Jimbaland83https://www.blogger.com/profile/04232544468928978336noreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-78757176986036754572022-10-03T06:37:44.503-07:002022-10-03T06:37:44.503-07:00Hi,
Not sure if this is still being monitored but ...Hi,<br />Not sure if this is still being monitored but I am trying to get this solution implemented, Ive set up the SSIS project and SQL task.<br /><br />When I run the ForEach Loop container, I get <br /><br />"The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.<br /><br />Connection is fine, and when I run the query in SQL mgt studio on a single file it works fine. I've also tried to specify the columns in the insert statement but no luck. Here's my expression...<br /><br />Declare @JSON varchar(max)<br /><br /><br />SELECT @JSON=BulkColumn<br /><br />FROM OPENROWSET (BULK 'MyFilePath', SINGLE_NCLOB) IMPORT<br /><br /><br />insert into dbo.devices(<br />[Server],[<br />LocalGroup],[Name],[Type],[Domain],[SID]<br />)<br /><br />SELECT *,'MyFilePath' FROM OPENJSON (@JSON)<br /><br /><br /><br />WITH<br /><br />(<br /><br />[Server] nvarchar(50),<br /><br />[Local Group] nvarchar(50),<br /><br />[Name] nvarchar(50),<br /><br />[Type] nvarchar(50),<br /><br />[Domain] nvarchar(50),<br /><br />[SID] nvarchar(50)<br />)<br /><br />Thanks!Jimbaland83https://www.blogger.com/profile/04232544468928978336noreply@blogger.com