有这么强的存储过程?????????你让微软去写吧,他们的SQL实现程度都没有这么智能

解决方案 »

  1.   

    --前台是很容易处理的这种结果集.比如存储过程你返回的是一个DataSet它的记录数:   ds.Tables[0].Rows.Count;
    它的列的个数: ds.Tables[0].Columns.Count;然后用 for (int i;i<=列的个数;i++)
           {
                   ....循环处理过程.....
            }
      

  2.   

    前台的处理很简单,通过SQLSERVER是困难,不知道怎么做才贴出来
    我的目的是想通过SQL自动发邮件,已经做完了,而且我也做了一个通过JAVA写的WEBSERVICE来转化成HTML格式,现在想不通过JAVA,而是通过SQL SERVER的存储过程来自动把查询出来的结果集转换成HTML格式,请高手指教
      

  3.   

    EXEC   sp_makewebtask   '\\服务器名称\C$\Test.html',   'SELECT   *     FROM   表名'
      

  4.   

    --如果要指定格式.就用模版列.--例子:--使用模板--创建模板页,注意其中的<%begindetail%><%enddetail%>"><%insert_data_here%>标记<html>
    <head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>使用sp_makewebtask生成网页测试</title>
    </head><body><div align="center">
    <table border="1" width="60%" id="table1" style="border-collapse: collapse">
    <tr>
    <td width="334" align="center">股票代码</td>
    <td width="334" align="center">股票简称</td>
    <td width="334" align="center">交易日期</td>
    <td width="334" align="center">收盘价格</td></tr>
    <%begindetail>
    <tr>
    <td width="334" align="center"><%insert_data_here%></td>
    <td width="334" align="center"><%insert_data_here%></td>
    <td width="334" align="center"><%insert_data_here%></td>
    <td width="334" align="center"><%insert_data_here%></td>
    </tr>
    <%enddetail%>
    </table>
    </div></body></html>--查询生成html文件EXECUTE sp_makewebtask @outputfile = 'C:\stock_code.HTM',
                           @query = 'select a.F_Code,F_Name,a.F_date,a.F_close 
                                     from dbo.交易 a join dbo.代码 b
                                     on a.F_code=b.F_code', 
                           @templatefile = 'C:\stock_trade.TPL',
                           @charset=N'gb2312',
                           @codepage=936
      

  5.   

    你也可以通过JOB来根据数据自动处理生成的Html页....
      

  6.   

    不需要生成文件,我存储过程的参数是一串HTML代码串,邮件对生成的页面直接显示就可以了