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 2000 Forums
 SQL Server Development (2000)
 Convert String

Author  Topic 

nhaas
Yak Posting Veteran

90 Posts

Posted - 2008-07-14 : 16:59:29
I have an odd question, can I convert a string from 6612512245 to 251-2245 in SQL?

thank you

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-14 : 17:02:16
Yes. SELECT SUBSTRING(Column1, 4, 3) + '-' + RIGHT(Column1, 4) FROM YourTable

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -