Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
I want to insert a character in a string.
How would I do that?

Example, I have a word "CHCHAM" and I want to insert "IM" in to make it "CHIMCHAM".
Posted

1 solution

try this,

SQL
declare @var varchar(100)
set @var ='chcham'

print substring(@var, 1,2) + 'im' + substring(@var,3,6)



hope it helps.
 
Share this answer
 
Comments
berrymaria 15-Jul-13 23:02pm    
gee thanks :D haven't thought of that :]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900