Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
strauss_jon
Starting Member
23 Posts |
Posted - 2014-08-21 : 11:33:02
|
Hi thereJust using set based SQL (not cursors or procs) is there a way to do the following. I have a single string (which is a formula) tokenised with variables. I want to replace this string via variable / values pairs which corresponding to different components of the formula. How can this be done via t-sql only. Essentially its looping through variable / value pairs and each time replacing the formula string, then the next iteration use the previously manipulated formula to de-tokenise it further until the whole formula has been replaced. So simple example: formula is A+BVariable Value Pair1: A = 8Variable Value Pair2: B = 31st iteration: 8 + B2nd iteration: 8 + 3I tried using cross apply but that gives me multiple rows. Maybe for xml path - but i don't like using hacks.Thanks in advance. Jon |
|
|
|
|