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.
Author |
Topic |
msdevcoder
Starting Member
4 Posts |
Posted - 2009-04-24 : 10:43:32
|
HiI am newbie to SSIS 2005.I need to pull info from two different sql servers, but not linked. (cant do that).For eg:I need to concatenate a single categoryId (like 101) from server1.db1.table1 to the productIds from server2.db1.table1. Like select categoryid from server1.db1.table1.categories where categoryname = 'Apparels'Then select categoryid + cast(productid as varchar(5)) as productuniqueid from Server2.db1.table1.products.1. I dont know if i can join queries between sql servers which is not linked.2. I tried storing the categoryid in a package variable. But dont know how to use that variable in select clause in sql command of oledb source editor.like select + '[user::categoryd]' + cast(productid as varchar(5)) as productuniqueid from Server2.db1.table1.products ???ThanksVenky |
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-04-24 : 11:00:00
|
If you have already stored the value in the variable, you can use OLE Db command to do the next select.Check this. it explains how it needs to be done.http://technet.microsoft.com/en-us/library/ms141773.aspx |
 |
|
msdevcoder
Starting Member
4 Posts |
Posted - 2009-04-24 : 12:35:44
|
I tried to usedeclare @catID as varchar(5)set @catID = ?SELECT distinct @catID + cast(productid as varchar) as ProductId FROM productsbut it throws syntax error. it didnt throw any error if i put that ? in a where clause.orCan we assign the user variable like this? for eg: set @catID = @[user::CategoryId] |
 |
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-04-24 : 14:36:44
|
Shouldn't it be justSELECT ? + cast(productid as varchar) as ProductId FROM productsWHERE productid = ? |
 |
|
|
|
|