Unanswered: SQL Column update with comparison with another table
I upload data from a Txt File(Txt_Temp) where i have VinNumber with 6 digits. Another table name Resrve_Temp1 where i have Vinumber with 17 digit. now i need to update the vinnumber 6 digit to 17 digit or to new column in Txt_temp. Txt_Temp - Table
I tried this code with no succes and only one row is updating
update Txt_Temp Set Txt_Temp.Vinnumber=dbo.R_ResrvStock.Vin
from dbo.R_ResrvStock inner join Txt_Temp on Right (dbo.R_ResrvStock.Vin,6)=Txt_Temp.VinNumber
Add this code in view
Select dbo.R_ResrvStock.Vin,R_Txt_Temp.Vinnumber,R_Txt_Te mp.Model_Code
from dbo.R_ResrvStock inner join R_Txt_Temp on Right (dbo.R_ResrvStock.Vin,6)=R_Txt_Temp.VinNumber
You realize it is not very safe to do this?
The last six digits of a VIN are simply serially generated. They could easily be duplicated across two different vehicles.
That said, you should be able to update by joining your six digit VIN to the right six digits of your full VIN. What is the datatype of the full VIN column?
If it's not practically useful, then it's practically useless.