Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 SQL Variable mapping problem

Author  Topic 

Raghav1981
Starting Member

2 Posts

Posted - 2009-04-09 : 06:36:10
In SSIS package Execute SQL task,

i'm able to pass the parameters to SQL query but not to the declared variables ?

any idea why parameters won't pass to Declared variables.

Here is the below example

i have created a variable Name with value Raghav and in Execute SQL Task mapped it to 0 parameter as i'm using OLEDN connection.

in SQL Query if i try below query

select * from emp where empname= ?

it perfectly works fine

but the same wuery if i change it to

DECLARE @EMPNAME VARCHAR(200)

SET @EMPNAME = ?

select * from emp where empname=@EMPNAME

it gives an error mentioning "Syntax error, permission violation,
or other nonspecific error "


any idea why its happening like this? please help me

Raghav

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-12 : 13:48:32
you cant declare and use variables like this. you can only use variables which are declared inside pacakge in variable window
Go to Top of Page
   

- Advertisement -