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 |
|
Poddy88
Starting Member
26 Posts |
Posted - 2009-02-25 : 07:53:49
|
| I need to combine 3 columns and so far can only get it working with numbers and not characters this is what iv been using for the numbersselect (server_id + router_id + switch_id) as hardware_id from cabinetThis works but only with numbers i need this with characters instead usingselect (server_hostname + router_hostname + switch_hostname) as Hostname from cabinetanybody got any ideas??error i get from code is "invalid number" |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-25 : 07:57:49
|
| [code]select convert(varchar,server_hostname) + convert(varchar,router_hostname) + convert(varchar,switch_hostname) from cabinet[/code] |
 |
|
|
Poddy88
Starting Member
26 Posts |
Posted - 2009-02-25 : 08:05:21
|
| Getting error "missing Expression" occuring at the first varchar, These columns im trying to conbined are already varchar2 not numbers, but when i used the previous combined method i think it tried to treat them as numbers |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2009-02-25 : 08:06:37
|
| varchar2 ??? are you using oracle?Em |
 |
|
|
Poddy88
Starting Member
26 Posts |
Posted - 2009-02-25 : 08:07:26
|
| yeh oracle |
 |
|
|
Poddy88
Starting Member
26 Posts |
Posted - 2009-02-25 : 08:07:44
|
| sry didnt mention that |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-02-25 : 08:09:05
|
| You might want to post this in an oracle forum then. |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2009-02-25 : 08:25:30
|
| in oracle you use || instead of + for concatenation.... but yes you'll get better responses in an oracle forumEm |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-25 : 09:07:30
|
| try www.dbforums.com |
 |
|
|
Poddy88
Starting Member
26 Posts |
Posted - 2009-02-25 : 13:03:46
|
| Thanks guys got it sorted elancaster u were correct got that info from oracle forum, sry for the mix up guys |
 |
|
|
|
|
|