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 |
|
satheesh
Posting Yak Master
152 Posts |
Posted - 2011-01-28 : 05:12:41
|
| Hi All,I tried to execute below query .I got an error -Conversation failed when converting the varchar vale 'Mr.Aa.Aa to data type int'.If i remove this [''+',' +.age+ ''] from select, its working fine.But i need to include the age field.How to amend this query.Any help would be highly appreciated.Age field datatye-intall other field datatype varcharselect ............................................................................from table1cross apply (select cst.title +''+ '.'+cst.fname +''+ ' '+cst.lname + ''+',' +.age+ ''+' ' as [text()]from cstwhere temp.Id = cst.Id order by cst.FName for xml path (''))cst(customerss)edit: moved to correct forum |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-28 : 05:15:01
|
... +convert(varchar(3),age)+ ... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
satheesh
Posting Yak Master
152 Posts |
Posted - 2011-01-28 : 05:25:28
|
| Thanks webferd,I changed thats ascross apply (select cst.title +''+ '.'+cst.fname +''+ ' '+cst.lname + ''+',' +convert( varchar (3),cst.age+ ''+' ' as [text()]It returned an error msg -Incorrect syntax near the keyword 'as'.Thank in advance.. |
 |
|
|
satheesh
Posting Yak Master
152 Posts |
Posted - 2011-01-28 : 05:33:20
|
| Many Thanks i sorted out. |
 |
|
|
|
|
|