Link to home
Start Free TrialLog in
Avatar of Gowtham Ramamoorthy
Gowtham Ramamoorthy

asked on

Need a query to replace strings:

Hi,

I need the values of price and weight to replaced in the expression column of formula1 table. COuld anyone help .

I have the below query tried but there is some error.

My query:
Select REPLACE((Select Expression from Formula1 where idnum =1),INPUTNAME,INPUTVALUES) AS TIME FROM Formula1

tABLE QUERY'S
Create table FORMULA1
(
Expression varchar(MAX),
INPUTVALUES INT,
InputName VARCHAR(256),
)

Insert into Formula1
values('Price+Weight' ,23,'weight')

Insert into Formula1
values('' ,14,'PRICE')
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gowtham Ramamoorthy
Gowtham Ramamoorthy

ASKER

Thanks Ryan. Could itbe possible for you to do this query without modifying the format of the table. For example take out the expression column from Formula 1 TABLE .

Imagine that we dont know the input column names 'price ' or weight. In that case this query wont work.
for your following question it seems to be a bit complicated, you probably can open another new question with your new requirements so that other experts may get a chance to assist you from there on.