|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Re: Find specific text in a string>> string strvalue ="(12.23+233.56)*12/100"; Not mine. It is T-SQL :)-- Show quote---------------------------------------------------------------------------- Louis Davidson - http://spaces.msn.com/members/drsql/ SQL Server MVP "Arguments are to be avoided: they are always vulgar and often convincing." (Oscar Wilde) "Louis Davidson" <dr_dontspamme_sql@hotmail.com> wrote in message news:... > First, this clearly isn't SQL Syntax, but that notwithstanding, you can > evaluate a function like this, (as long as it fits SQL Syntax of course) > > declare @value decimal (10,8) > > declare @formula varchar(200), @query nvarchar(2000) > > set @formula = '(12.23+233.56)*12/100' > > set @query = 'select @value = (' + @formula + ')' > > EXEC sp_executesql @query, > > N'@Value decimal(10,8) output', > > @value output > > select @value > > I would strongly suggest against it, since this is really not SQL's > strongpoint. This is one of the rare cases where I would probably suggest > you storing the expression and the answer in two columns (using the middle > tier layer to calculate the value, or this method could be used in a a > singleton insert.) > > > > -- > ---------------------------------------------------------------------------- > Louis Davidson - http://spaces.msn.com/members/drsql/ > SQL Server MVP > "Arguments are to be avoided: they are always vulgar and often > convincing." > (Oscar Wilde) > > <ksrajalaks***@gmail.com> wrote in message > news:1139650655.809064.217710@f14g2000cwb.googlegroups.com... >> If am having the value as >> string strvalue ="(12.23+233.56)*12/100"; >> i've to find the value.so that am converting to double. but it throws >> error. tel me how to find value? >> > > |
|||||||||||||||||||||||