declare @ccount int
select @ccount=sum(jz) from daydtaticexec('insert into monthstatic(ccountjz) values ('+@ccount+')')

解决方案 »

  1.   

    感谢!!我刚学看不太懂,请问declare @ccount int直接写在程序中吗?我运行时怎么说这是无效字符.
    后两句是分别的SQL语句吧?
      

  2.   

    sql="insert into MonthStatic (ccountjz) values('"   "')" 
    改为
    sql="insert into MonthStatic (ccountjz) values('" & ccount &  "')" 一楼写的是SQL中的代码,不是在程序中的。
      

  3.   

    sql="declare @ccount int
    select @ccount=sum(jz) from daydtatic
    exec('insert into monthstatic(ccountjz) values ('+@ccount+')')"
      

  4.   

    你问的好像不是SQL中的代码.看样子你需要的是ASP里的SQL语句.
    是不是??先确定你的问题.一会来.
      

  5.   

    确实是ASP中的SQL语句。我刚开始学搞不太懂