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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 combine a integer and string to new string value

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2007-06-29 : 04:52:58
Hi

I would like to add a integer value with a string value like this

SELECT (dbo.mytable.ID & dbo.mytable.thename) AS MyNewString FROM MyTable

How would I do that?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-29 : 04:59:16
[code]SELECT CONVERT(varchar(10), dbo.mytable.ID) + dbo.mytable.thename AS MyNewString
FROM MyTable[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-29 : 09:08:52
Seems now-a-days lot of concatenated questions

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2007-06-29 : 09:11:43
Worked perfect, Thanks!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-29 : 09:15:04
Note that during concatenation you should also handle NULL if one or more of the columns allow NULLs

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -