I am having issue with Execute script task. Currently the task is executing stored procedure and result is assigned to variable. Now I want to execute both the stored procedure and sql select statement in single execute task I tried to acheive it by using dynamic sql statements as shown below.
SQl Script
DECLARE @Query NVARCHAR(250)
DECLARE @ParmDefinition NVARCHAR(250)
DECLARE @Id int
DECLARE @Usr_Id VARCHAR(50)
DECLARE @TCId INT
DECLARE @IsSuccess bit
Set @Query = 'Exec InsertSp @Id,@Usr_Id,@TCId OUTPUT'
SET @ParmDefinition = '@Id INT,@Usr_Id VARCHAR(50),@TCId INT OUTPUT'
EXEC sp_executesql @Query,
@ParmDefinition,
@Id=2,
@Usr_Id='domain\fn.lastname',
@TCId=@TCId OUTPUT
Set @Query = 'SELECT TOP (1) @IsSuccessOut = IsSuccess
FROM dbo.TableA AS a
INNER JOIN dbo.TableB AS b
ON a.Id = b.Id
WHERE (b.Name = ''LoadDaily'')
ORDER BY StartTime DESC'
SET @ParmDefinition = '@IsSuccessOut INT OUTPUT'
EXEC sp_executesql @Query,@ParmDefinition,@IsSuccessOut=@IsSuccess output
SELECT @TCId AS 'TCId',@IsSuccess as 'IsSuccess'
I created variable and assigned the above query to it.
In Execute SQl task,I have assigned the variable
i set result of the variable to two variables
When I am trying to run package, not able to get values of output to result variables. Please let me know how can i get out put of above sql.


SELECT 0 AS 'TCId', CAST(1 AS bit) as 'IsSuccess'Do you see the values assigned? And either way, how are you determining whether the value was assigned? - billinkc