Re: Convert string to Number

From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 03/12/04


Date: Fri, 12 Mar 2004 09:01:09 +0530

hi ricky,

prefix the string with 'select ' and use EXEC to execute it.

Ex:

declare @x varchar(50)
set @x='150000*0.9*21/31'
set @x= 'select ' + @x
exec (@x)

-- 
Vishal Parkar
vgparkar@yahoo.co.in


Relevant Pages

  • Re: how to assign the contents of a field to a variable
    ... You meant EXEC(@MySQL), not EXEC @MySQL. ... as far as the code inside the EXECUTE() string is concerned. ... you may have to move a hunk more code into the EXEC() ...
    (microsoft.public.sqlserver.programming)
  • Re: EXECUTE tsqlstring with parameters
    ... I've tried using exec by itself, exec sp_executesql with an embedded exec ... string and sp_executesql with parameter substitution. ... until I need to execute a stored procedure that uses an OUTPUT parameter. ...
    (microsoft.public.sqlserver)
  • Re: dynamically create a column
    ... Build your create statement in a string, then execute it using the EXEC ... > (@X int) ...
    (microsoft.public.sqlserver.programming)
  • Re: Application role to access xp_cmdshell
    ... This necessitates that your user procs be owned ... See Cross-database chaining in the SQL 2000 ... You will also need to allow non-sysadmin users to execute xp_cmdshell. ... EXEC sp_dboption 'MyDatabase', 'db chaining', true ...
    (microsoft.public.sqlserver.security)
  • Re: regex to find an stored proc name
    ... One major flaw in yours though is that is doesn't handle the return type as ... exec this a, b, c ... execute ... "Kevin Spencer" wrote: ...
    (microsoft.public.dotnet.languages.csharp)