Click here to Skip to main content
14,333,745 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi,

I am having an expression task which has the following code in it:-

@[User::VendorFileName] = TOKEN(RIGHT( @[$Package::FilePath] , FINDSTRING(REVERSE(@[$Package::FilePath]), "\\", 1) -1),".",1)

When we evaluate the above code it shows the output i.e V100

Below this I have an Execute Sql task in which I am passing dynamic sql statement through an expression,

Code below:-

"SELECT
	p.partition_number AS PartitionNmber
FROM sys.indexes i
INNER JOIN sys.partitions p
	ON i.object_id=p.object_id
	AND i.index_id=p.index_id
INNER JOIN sys.partition_schemes ps
	ON ps.data_space_id = i.data_space_id
INNER JOIN sys.partition_functions pf
	ON pf.function_id = ps.function_id
LEFT OUTER JOIN sys.partition_range_values rv
	ON rv.function_id = pf.function_id
	AND rv.boundary_id = p.partition_number
WHERE i.object_id = object_id('" + @[User::StagingTableSchemaName]  + "." + @[User::StagingTableName] + "')
AND rv.value= '" + @[User::VendorFileName] + "'"


When I evaluate the above request it gives me :-

SELECT
	p.partition_number AS PartitionNmber
FROM sys.indexes i
INNER JOIN sys.partitions p
	ON i.object_id=p.object_id
	AND i.index_id=p.index_id
INNER JOIN sys.partition_schemes ps
	ON ps.data_space_id = i.data_space_id
INNER JOIN sys.partition_functions pf
	ON pf.function_id = ps.function_id
LEFT OUTER JOIN sys.partition_range_values rv
	ON rv.function_id = pf.function_id
	AND rv.boundary_id = p.partition_number
WHERE i.object_id = object_id('STG.tablename')
AND rv.value= ''


The issue is that it is not populating rv.value value and it is taking blank.

Can someone suggest where am i going wrong?

What I have tried:

I tried using delayvalidation set to true. but it did not work
Posted
Updated 9-Oct-19 1:05am
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Well, it's obviously your expression task that's failing, so I would start there. Try just setting the User::VendorFileName to some value, such as "test".

If your evaluated request shows rv='test', set User::VendorFileName to the value of @[$Package::FilePath]. If that's okay, work your way out from the middle of your expression and see what comes back.
   
Comments
Member 12954547 9-Oct-19 7:40am
   
I did this one too and set the variable to some value and yes it did populate rv.value=test.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100