Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove Nth character in a string

Status
Not open for further replies.

bmacbmac

IS-IT--Management
Jan 26, 2006
392
0
0
US
Hi everyone,

I need to remove the 4th character from Myfield where len(myfield) = 5

I have searched around and surprisingly can't find a way to do this. Any ideas?

Thanks!
 
You can use the STUFF function to do this.

Code:
Declare @Data VarChar(20)
Set @Data = '12345'

Select @Data, Stuff(@Data, 4, 1, '')


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Perfect! And easy.....

Thanks man.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top