Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Equivalent of Transform(@R)
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Equivalent of Transform(@R)
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01518159
Message ID:
01518159
Vues:
99
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
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform