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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Evaluate String

Author  Topic 

Ex
Posting Yak Master

166 Posts

Posted - 2005-05-29 : 21:51:09
Hey all,

not sure if this exists but is there a way to evaluate a varChar which is actually a math expression?
i.e

varchar '5 + 4 * 20'
answer 85



------------------------------------------------------------------

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Rich Cook

raclede
Posting Yak Master

180 Posts

Posted - 2005-05-29 : 22:17:55
try this one: use Dynamic Query..

DECLARE @Compute VARCHAR(15)
SET @Compute = '5 + 4 * 20'
EXEC ('SELECT ' + @Compute)

"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year, killing everyone inside. "

raclede
Go to Top of Page

Ex
Posting Yak Master

166 Posts

Posted - 2005-05-29 : 22:22:06
of cource :) so simple

thanks

------------------------------------------------------------------

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Rich Cook
Go to Top of Page

pah4mpo
Starting Member

2 Posts

Posted - 2006-01-27 : 08:19:43
Further to this, is it possible to update a whole table of varchar math expressions withour using a cursor
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-27 : 08:21:13
quote:
Originally posted by pah4mpo

Further to this, is it possible to update a whole table of varchar math expressions withour using a cursor


Post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-01-27 : 09:23:56
quote:
Originally posted by Ex

------------------------------------------------------------------

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Rich Cook




Hey Rich Cook,

Did u copy the Signature of Cakkie in CodeGuru ??
http://www.codeguru.com/forum/showthread.php?t=22382

Go to Top of Page
   

- Advertisement -