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 |
|
sivasankarp
Starting Member
4 Posts |
Posted - 2009-11-25 : 02:21:53
|
| HiAm new to Sql ProgrammingI have two tables.ID, AID11 2,3,4,5I want to display AID'sI write the inner join to get the Name of AID values but am getting error(Invalid datatype conversion)select AName from firsttable as f inner join TableA as t f.AID= t.AID(here AID is varchar so am getting the error)How to split the numbers and join the IDThanks in advanceSivasankar puppala |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-11-25 : 02:52:59
|
| select AName from firsttable as f inner join TableA as t on ','+t.AID+',' like '%,'+cast(f.AID as varchar(10))+',%'MadhivananFailing to plan is Planning to fail |
 |
|
|
sivasankarp
Starting Member
4 Posts |
Posted - 2009-11-25 : 03:18:38
|
| Thanks for your reply its working but i want to show AName with comma.ex:AID =>3,4,5AName=>Bangalore,Hyderabad,ChennaiSivasankar puppala |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-11-25 : 04:23:46
|
| Which version of SQL Server are you using?MadhivananFailing to plan is Planning to fail |
 |
|
|
peterkirubakaran
Starting Member
12 Posts |
|
|
|
|
|