March 4, 2013 at 1:34 pm
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!!!
March 5, 2013 at 7:56 am
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.
March 6, 2013 at 11:48 am
I got it...thanks a lot!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy