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.
Author |
Topic |
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-11-27 : 03:10:29
|
i make a query and i want on a certain col say called col1to insert every x letter my own string for example :col1--------dogcatafeter inset :dAAAogcAAAathow can i do this?thnaks in advancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-27 : 03:16:10
|
Use STUFF functionSELECT STUFF('dog', 2, 0, 'AAA'), STUFF('cat', 2, 0, 'AAA')Peter LarssonHelsingborg, Sweden |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-11-27 : 03:22:42
|
thnaks alotis there a way making it happen more thne once on a string likeL:abracadabra ===>> abAAraAAcaAAdaAAbrAAaIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-27 : 03:37:32
|
[code]declare @s varchar(1000), @r varchar(1000)select @s = 'abracadabra', @r = ''select @r = @r + q.gfrom ( select substring(@s, 1 + 2 * number, 2) + CASE WHEN number < len(@s) / 2 THEN 'AA' ELSE '' END g from master..spt_values where name is null and number between 0 and len(@s) / 2 ) qselect @r[/code]Peter LarssonHelsingborg, Sweden |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-11-27 : 03:39:25
|
ok thnaks laotIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-27 : 07:46:02
|
quote: Originally posted by pelegk2 thnaks alotis there a way making it happen more thne once on a string likeL:abracadabra ===>> abAAraAAcaAAdaAAbrAAaIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
Why do you need this?MadhivananFailing to plan is Planning to fail |
|
|
|
|
|
|
|