Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Equivalent of Transform(@R)
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Equivalent of Transform(@R)
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01518159
Message ID:
01518159
Views:
98
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
Next
Reply
Map
View

Click here to load this message in the networking platform