Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:14:54+00:00 2026-06-12T16:14:54+00:00

I have this procedure ALTER proc [dbo].[adenti] ( @entra nvarchar(max) ) as DECLARE @sql

  • 0

I have this procedure

ALTER proc [dbo].[adenti] 
(
   @entra nvarchar(max)
)
as 
DECLARE @sql varchar(4000); 
SET @sql = 'INSERT INTO provaxml (arquivo) SELECT CAST(BulkColumn AS XML) FROM OPENROWSET(BULK ''' + @entra + ''', SINGLE_BLOB) as arquivo'; 
EXEC( @sql );

The code above works.

Is it possible to use Integration Services to insert all the XML file in a path into a SQL table?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:14:55+00:00Added an answer on June 12, 2026 at 4:14 pm

    There are two different approaches you can do.

    The first is as user569711 outlined and use a ForEach Enumerator and call your existing stored procedure. Advantage to this is your behaviour should be exactly as what you are currently experiencing and your testing should only need to focus on ensuring the SSIS package is picking up the right files.

    The second is to use the out of the box capabilities of SSIS to deal with importing BLOB types.

    Control Flow

    You will want 1 to 2 variables defined depending upon your approach. Both will be string data types. I created SourceFolder and CurrentFileName. The former defines where the files will come from and is used in either approach. The latter is used in the ForEach Loop Container to capture the “current” file.

    control flow

    Data Flow

    To make the data flow work, you will need to get the fully qualified list of file names added into the pipeline. Easiest way is to use a Script Transformation, acting as a source and have that add in all the files meeting your condition (*.xml).

    data flow

    Foreach Loop Container

    Configure as such

    Collection

    enter image description here

    Variable Mappings

    enter image description here

    Execute SQL Task

    Configure thusly

    enter image description here

    enter image description here

    Script Source

    This task will add the available files into the data flow. Minor note, this will traverse subfolders which differs from how we have the Foreach configured. It’s a simple change to the third parameter (or omission) to make it top level only.

    Identify your variable so it is available in the script task

    enter image description here

    Add the appropriate output columns. Your lengths may vary based on your environment.

    enter image description here

    Script here

    using System;
    using System.Data;
    using System.IO;
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    using Microsoft.SqlServer.Dts.Runtime.Wrapper;
    
    [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
    public class ScriptMain : UserComponent
    {
    
        public override void CreateNewOutputRows()
        {
            string fileMask = string.Empty;
            string sourceFolder = string.Empty;
    
            fileMask = @"*.xml";
            sourceFolder = this.Variables.SourceFolder;
    
            foreach (string fileName in Directory.GetFiles(sourceFolder, fileMask, SearchOption.AllDirectories))
            {
                Output0Buffer.AddRow();
                Output0Buffer.FileName = fileName;
                Output0Buffer.SourceName = "Dataflow";
            }
        }
    }
    

    Import Column Transformation

    Configure like this

    enter image description here

    Make note of the ID here

    enter image description here

    Tie that ID back to the column with the name

    enter image description here

    OLE DB Destination

    Configure. Does not support Fast Load option.

    enter image description here

    enter image description here

    Reference

    Nice post on using the Import Column Transformation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this stored Proc: ALTER Procedure [dbo].[GetWebinars] ( @GroupingCode varchar(max) = 'AVM', @ItemNumber
I have written this procedure in SQL and is working ALTER proc [dbo].[gridcombo] (@tabela
If I have this stored proc definition minus the body ALTER PROCEDURE sp_AlloctionReport(@where NVARCHAR(1000),
Hi i have the following stored proc in SQL Server 2005: ALTER PROCEDURE [dbo].[slot_sp_EngineerTimeslots_Group]
I have a procedure and the code looks like this: ALTER PROCEDURE [dbo].[usp_Gen_Proc] (@ID
I'm going mad on this one. I have the following SP: ALTER PROCEDURE [BankImport].[spBI_getIsBatchUnique]
I have the following stored procedure ALTER PROCEDURE [dbo].Test AS BEGIN CREATE TABLE ##table
I have stored procedure : ALTER PROCEDURE [dbo].[proc_GetApplicationByCostCentreId] ( @CostCentreId TINYINT, @DepartmentId INT =
I have a stored procedure when I am executing this query in SQL Server
Can someone please it explain this to me? I have this stored proc: ALTER

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.