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
 General SQL Server Forums
 New to SQL Server Programming
 Inserting Space

Author  Topic 

satheesh
Posting Yak Master

152 Posts

Posted - 2011-11-23 : 09:52:10
Dear All,

I have phonenumber field in cst table.And the data in that be for eg '07712345678'

I need to insert space after 5th number ie '07712 345678'
How to do this.Any help would be highly appreciated.

Thanks
SG

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-11-23 : 09:54:27
update cst
set phonenumber = stuff(phonenumber ,6,0,' ')

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-11-23 : 09:54:28
[code]
select stuff('07712345678', 6, 0, ' ')
[/code]




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

Go to Top of Page

satheesh
Posting Yak Master

152 Posts

Posted - 2011-11-23 : 10:06:02
Its working!

Thank you all!!
Go to Top of Page
   

- Advertisement -