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