SQLTeam.com | Weblogs | Forums

Unable to build SSIS ConnectionString Expression using local variable


#1

I am getting the following error when trying to create an SSIS ConenectionString expression using a local variable. The connection string shown below used to work in our SQL 2012 environment, but now fails using SQL Server 2014. The error is:

The data types DT_WSTR and DT_I4 are incompatible for binary operator "+"........
Attempt to set the result type of binary operation "Data Source=" + @[User::sys_name] failed.....

Connection shown below.-

"Data Source=" + @[User::sys_name] + ";Initial Catalog=MyDBName;Provider=SQLNCLI11;Integrated Security=SSPI;Auto Translate=False;"


#2

Try:
ConCat("Data Source=" , dts.Variables("User::sys_name").Value.ToStirng , ";Initial Catalog=MyDBName;Provider=SQLNCLI11;Integrated Security=SSPI;Auto Translate=False;")