t-sql 2012 pass parameters

  • I would like to know how to execute straight t-sql in sql server 2012 from ssis manager that passes 3 parameters to the sql listed below:

    Baiscally the sql looks like the following:

    Select * from customer_table

    where customer_name = @custname and customer_number = @custnumber

    and customer_state = @custstate.

    @custname is varchar(30), @custnumber is varchar(10), and @custstate is varchar(02)

    Thus can show me the sql that will run the sql listed above?

  • -- declare the variables

    declare @custname is varchar(30)

    ,@custnumber is varchar(10)

    ,@custstate is varchar(02)

    ;

    -- set values for the variables

    set @custname = 'SomeName';

    set @custnumber = '0012345';

    set @custstate = 'AB';

    -- execute the query

    Select * from customer_table

    where customer_name = @custname

    and customer_number = @custnumber

    and customer_state = @custstate;

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

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