|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, April 22, 2013 2:08 PM
Points: 19,
Visits: 63
|
|
Hello experts, I have 2 tables. One of the tables has the data I need to know which user input it. On the table I have a column name called owner_m, when I run the data import for some reason my sistem is bringing me instead of the user_names the id_user_numbers that is store in tbluser table. I need to update my data table with the users name and I have the following query for that:
update A set final_owner=tblUser.tName FROM A INNER JOIN tblUser ON cast(A._owner_m as int) = cast(tblUser.aUserID as int)
owner_m is a varchar and User id is an int. Thats why Im using the cast option.
But for some reason the query is giving me the same user id for all the fields as follows: owner_m tname 19 Carol 20 Carol 28 Carol
instead of 19 Carol 20 Rolando 28 Estefania.
Im asumming is because the data type and I already fix that with the cast function.
I dont know what else to do, please help!!!
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: 2 days ago @ 12:44 PM
Points: 43,
Visits: 120
|
|
Change your query to:
SELECT A.final_owner, tblUser.tName, A._owner_m, cast(A._owner_m as int), tblUser.aUserID, cast(tblUser.aUserID as int) FROM A INNER JOIN tblUser ON cast(A._owner_m as int) = cast(tblUser.aUserID as int)
And post the results.
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, April 22, 2013 2:08 PM
Points: 19,
Visits: 63
|
|
|
|
|