求思路:基于数据库表字段的公式编辑器怎么设计

解决方案 »

  1.   

    公式为字符存到表里, 然后读取表里的公式(字符), 然后执行 sp_executesql
      

  2.   

    基于数据库表字段的公式编辑器?
    就是一个普通字符串输入框,要求内容就是sql语句:使用了该表表名、字段名
    如:select (f1-f2)/(f3+f4) from tb
      

  3.   


    create table demo (a int, b int, c int)
    insert into demo select 1,2,3
    select * from demo
    declare @t table (id int , querystr nvarchar(1000)) --querystr 就是你的公式拼成的SQL语句insert into @t select 1,'select a+1, b*2, a+b+c from demo'  declare @str nvarchar(1000)
    select @str = querystr from @t where id = 1exec sp_executesql @strdrop table demo