Sandeep Yadav

Sandeep Yadav

  • NA
  • 68
  • 590

Replacement of nvarchar column value to int

Nov 17 2018 3:52 AM
Hi
 
I have a table that stores personal informations. Personal infos have a field of vehicle type in which user can select multiple vehicles from multiselect dropdown list.
So I have to store selected dropdown item(Multiple ids) in a single column of table(Column Name say RelatedVehicles and the values stored the column in my case is 1,29 in nvarchar(200) type column).
Now I have to fetch this value(1,29) which nvarchar type to 'In' clause of another query like below:
 
select * from VehicleMaster where vId in (Select RelatedVehicles from UserMaster where UID=1).
 
Here vId in of Integer type and subquery returns nvarchar type value i.e ('1,29') .
Please suggest...
 
I have tried replacing the (,) to ',' so it becomes '1','29' now then it is not accepting it.
 

Answers (6)