Append text. | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Append text.

I want to add some text in a varchar variable, How will it possible. for example. string strVar
for(int i=0;i<5;i++)
{
strVar+=i;
} I want to perform the above functionality in sql server.
declare @strvar varchar(100), @i int
select @strvar=”,@i=0 while @i<5
begin
SET @[email protected]+convert(varchar(10),@i)
set @[email protected]+1
end
select @strvar,@i
]]>