>In Foxpro I can easily create a comma separated list of digits/characters with the transform function, like this:
>
>
>lcSource = 'abcdefghijklmnopqrstuvwxyz'
>? TRANSFORM(TRANSFORM(lcSource), '@R ' + REPLICATE('9,', LEN(TRANSFORM(lcSource))))
>lcSource = 1234567890
>? TRANSFORM(TRANSFORM(lcSource), '@R ' + REPLICATE('9,', LEN(TRANSFORM(lcSource))))
>
>
>Can I do this in T-SQL without loops? I am creating a dial string from a list of numbers selected from a table, but I need to introduce a pause (a comma) between each digit, my current select looks like this:
>
>
> Select @cDialNumbers += Cast(Stations.StnNo as varchar(10)) + ','
> from Stations
> join master.dbo.int$ListToCursor(@cList, ';') L ON L.Value = Stations.PK
> order by Stations.StnNo;
>
>
>The parameter to this function (@cList) was a semi colon separated list of stations id that is why I need the join but we can ignore it for this problem, that works fine, my problem is that this way I only insert a pause between stations and I need a comma between each digit of the StnNo too
>
>TIA
>Hugo
Why not doing this in FrontEnd?
I think this is better place to format strings. :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.