我在TSQL中需要这样的东西
string myString = "123";
for (int i = 0; i < myString.Length; i++)
{
myString.Insert("ABC", i);
}
Output "ABC1ABC2ABC3"
Run Code Online (Sandbox Code Playgroud)
declare input as varchar(1000) -- Choose the appropriate size
declare output as varchar(1000) -- Choose the appropriate size
select @input = '123', @output = ''
declare @i int
select @i = 0
while @i < len(@input)
begin
select @i = @i + 1
select @output = @output + 'ABC' + substring(@input, @i, 1)
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8725 次 |
| 最近记录: |