-- Note: -- 1. Normally looping is done in a user defined function. -- 2. Here is a make shift way in straight SQL without a user defined function. declare @strValue varchar(255) declare @intCount int declare @intCountMax int set @intCount = 0 set @intCountMax = 255 forloop_begin: set @strValue = (select (convert(varchar(15),@intCount) + '-' + char( @intCount ) )) print @strValue set @intCount = @intCount + 1 if ( @intCount <= @intCountMax ) begin goto forloop_begin end forloop_end: