Passing datatime , int variables into a table through execute sql task in SSIS

  • I have a Audit table something like below but it keeps throwing error "resultset property not set correctly"

    CREATE TABLE [dbo].[SSISAUDIT](
     [AuditID] [int] IDENTITY(1,1) NOT NULL,
     [CreateDate] [datetime] NULL,
     [BatchID] [int] NULL,
     [BatchDate] [datetime] NULL,
     [StartDate] [datetime] NULL,
     [EndDate] [datetime] NULL,
     [TotalRecords] [int] NULL,
     [Inserts] [int] NULL,
     [Updates] [int] NULL
    ) ON [PRIMARY]
    GO

    Parameters declared as in SSIS

    [CreateDate][datetime]
    [BatchID] [varchar]
    [BatchDate][datetime]
    [StartDate] [datetime]
    [EndDate] [datetime]
    [CntTotal] [int]
    [CntInsert] [int]
    [CntUpdates] [int]

    EXECUTE SQL TASK : Passing paramters in execute sql task (Parameter mapping)

    $pacakge::BatchNumber : Nvarchar

    $pacakge::Startdate : Date
    $pacakge::ENDdate :DATe
    $pacakge::CntInsert :Long
    $pacakge::CntUpdates:Long
    $pacakge::cntTotal :Long

    EXECUTE SQL TASK : SQL QUERY :
    INSERT INTO [dbo].[SSISAUDIT]
               ([CreateDate]
               ,[BatchID]
               ,[StartDate]
               ,[EndDate]
               ,[Inserts]
               ,[Updates]
                ,[TotalRecords])
    Values(
         GETDATE()
        ,?
        ,?
       ,?
        ,?
        ,?
               ,?

    )

    Please help me figure out the issue. Issue seems to look simple but unable to figure out where I am going wrong

  • As executing such a set of SQL does NOT produce a result set, the setting should probably be NONE.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Steve seems to be on the money here. The error is telling you to look at the resultset property, not the parameters. I suspect you currently have it set to Single Row, or Full Result Set. As a result SSIS is expected some kind of dataset back from the query (and for there for be variable mappings for that output), however, as the INSERT doesn't return anything it's generating an error.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • Thom A - Wednesday, March 13, 2019 3:07 PM

    Steve seems to be on the money here. The error is telling you to look at the resultset property, not the parameters. I suspect you currently have it set to Single Row, or Full Result Set. As a result SSIS is expected some kind of dataset back from the query (and for there for be variable mappings for that output), however, as the INSERT doesn't return anything it's generating an error.

    I figured the issue is with datatypes.

  • komal145 - Thursday, March 14, 2019 8:06 AM

    Thom A - Wednesday, March 13, 2019 3:07 PM

    Steve seems to be on the money here. The error is telling you to look at the resultset property, not the parameters. I suspect you currently have it set to Single Row, or Full Result Set. As a result SSIS is expected some kind of dataset back from the query (and for there for be variable mappings for that output), however, as the INSERT doesn't return anything it's generating an error.

    I figured the issue is with datatypes.

    As you aren't returning a result set, what data type would exist to be compared to?

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply