Running same ExecuteSQL with different parameters

  • Hi All

    I have a requirement where I am executing 2 ExecuteSQL task in parallel which calls the same proc. The proc has a parameter: @BatchSize

    I want the first executeSQL task to run with value @BatchSize and wants the second task to execute with parameter @BatchSize*2.

    How can this be achieved as ?*2 doesn't work.

    thanks

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • I assume you're doing something like this:

    EXEC dbo.YourProcedure @BatchSize = @BatchSize * 2;

    With a Stored Procedure you can't pass expressions as parameters, only variables or literals. If you want to use an expression you must first derive it and then pass that value:

    SET @BatchSize = @BatchSize * 2
    EXEC dbo.YourProcedure @BatchSize = @BatchSize;

    If this isn't the problem, you need to explain in more detail what it is you're doing, the error/unexpected behaviour you're getting, and what you're expecting to happen.

    Thom~

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

  • How can this be achieved as ?*2 doesn't work.

    With nearly 9000 points, you should be able to do better than this.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 3 posts - 1 through 2 (of 2 total)

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