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 |
risa.86
Starting Member
3 Posts |
Posted - 2007-06-16 : 04:05:05
|
I want to combine a column with Id and other with Name.For eg: If Id is 01 and Name is 'Tom', the output should be 01-Tom.I am not able to execute it using || or CONCAT since Id has the data type int and Name is a string.Do you have a solution?`RG` |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-06-16 : 04:07:08
|
[code]select right('00' + convert(varchar(2), Id), 2) + '-' + Name[/code] KH |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-06-16 : 08:38:43
|
<<I am not able to execute it using || or CONCAT since Id has the data type int and Name is a string.>>This is SQL Server ForumIf your question is related to ORACLE then post at Oracle related ForumMadhivananFailing to plan is Planning to fail |
|
|
risa.86
Starting Member
3 Posts |
Posted - 2007-06-17 : 07:56:04
|
Thanks for your help. Btw didnt know Sql queries in SQl Server and Oracle were different! quote: Originally posted by madhivanan <<I am not able to execute it using || or CONCAT since Id has the data type int and Name is a string.>>This is SQL Server ForumIf your question is related to ORACLE then post at Oracle related ForumMadhivananFailing to plan is Planning to fail
`RG` |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2007-06-17 : 08:22:56
|
Sql SErver queries are called Transact SQL while oracle is called PL SQL |
|
|
|
|
|