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)
 Adding increasing value to string

Author  Topic 

Steve2106
Posting Yak Master

183 Posts

Posted - 2012-06-11 : 15:53:48
Hi there,

I want to add a increasing numeric value to a string. Something like,

'ABC' & +1 & 'XYZ'

When I execute I get this error:
Conversion failed when converting the varchar value 'AB' to data type int.

Thanks for your help.

Best Regards,



Steve

shilpash
Posting Yak Master

103 Posts

Posted - 2012-06-11 : 16:52:59
use cast or convert function
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-11 : 18:27:02
do you mean this?

http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Steve2106
Posting Yak Master

183 Posts

Posted - 2012-06-12 : 03:07:38
Hi There,

Thanks for your replies, I'll use your suggestions and see how I get on.

Viska that link was very useful, thank you.

Best Regards,

Steve.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-06-12 : 15:19:47
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -