Execute SQL Task: Cannot assign value to the variable
DECLARE 
   @PartitionDate varchar(8),
   @Date int
SELECT 
   @PartitionDate = MAX(PartitionDate)  
FROM PartitionLog (NOLOCK)


SELECT 
   @Date = MIN(DateKey)
FROM DimDate WHERE CAST(DateKey as varchar(8)) > @PartitionDate


IF NOT CONVERT(varchar(8),GETDATE(),112) = @PartitionDate 
SELECT @PartitionDate = CAST(DateKey as varchar(8))
FROM DimDate (NOLOCK)
WHERE DateKey = @Date


SELECT @PartitionDate AS PartitionDate ,
'IISDW_' + @PartitionDate  AS PartitionName
GO

I have the above SQL stmt in the excute SQL task and declared 2 variable "PartitionDate" and "PartitionName" in the Package, the RESULT SET I hav given as "Single Row" and when I run the ETL I get the error as 

[Execute SQL Task] Error: An error occurred while assigning a value to variable "PartitionDate": "Exception from HRESULT: 0xC0015005".



  • Edited by SQL_Gun 12 hours 23 minutes ago edit
March 20th, 2015 2:45pm

Does your package variable datatype match the datatype of your parameter?

Is your Package variable assigned to the parameter in the task editor?

And does the parameter name in the task editor match the parameter names in your stored procedure?


  • Marked as answer by SQL_Gun 12 hours 0 minutes ago
Free Windows Admin Tool Kit Click here and download it now
March 20th, 2015 2:58pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics