本段文章节选自铁道出版社新出的《用BackOffice建立Intranet/Extranet应用》一书(现已在海淀图书城有售)。本书详尽地讲述了如何使用微软BackOffice系列产品来组建Intranet/Extranet应用。通过它您将掌握NT的安装和设置、使用IIS建立Web站点、通过ILS建立网络会议系统、用Exchange建立企业的邮件和协作系统、用SQL Server建立Web数据库应用、用Proxy Server建立同Internet安全可靠的连接、用Media Server建立网络电视台/广播站、用Chart server建立功能强大的聊天室、用Site Server建立个性化的邮件列表和分析网站的访问情况、用Commerce Server建立B2B或B2C的电子商务网站。此外本书还对网络的安全性进行了讨论,从而指导您建立一个更为健壮和安全的网络应用。阅读本书之后,您将发现实现丰富多彩的网络应用原来这样简单……
绝对原创,欢迎转载。但请务必保留以上文字。
use test
go
declare
@riqi varchar(20),
@filepath varchar(255),
@listfile varchar(255),
@command varchar(255)
set @riqi=left(convert(varchar(40),getdate(),20),10)
set @filepath=''d:/webout/''+@riqi+''/''
set @command=''md ''+@filepath
execute master.dbo.Xp_cmdshell @command
set @command=''md ''+@filepath+''images''
execute master.dbo.Xp_cmdshell @command
set @command =''copy d:/test/files/*.* d:/webout/''+@riqi+''/''
execute master.dbo.Xp_cmdshell @command
set @command =''copy d:/test/files/images/*.* d:/webout/''+@riqi+''/images/''
execute master.dbo.Xp_cmdshell @command
set @command =''copy d:/test/''+@riqi+''/*.* d:/webout/''+@riqi+''/''
execute master.dbo.Xp_cmdshell @command
set @listfile=@filepath+''list.htm''
execute sp_makewebtask
@outputfile=@listfile,
@query=''select distinct banmian
from gaojian
where kanwu=''''出版报'''' and datepart(yy,riqi)=datepart(yy,getdate()) and datepart(dy,riqi)=datepart(dy,getdate())'',
@templatefile=''d:/test/list.tml'',
@codepage=936
在此段代码中先定义了一些变量,用来调用存贮过程时使用。其中@riqi变量用于存放当日的日期(其格式为yyy-mm-dd);@filepath变量用于存放产生静态页面的路径;@listfile变量用于存放版面列表页面文件的路径和文件名;@command变量用于存放要执行的系统命令。
随后我们对各个变量进行赋值。并调用xp_cmdshell存贮过程来完成建立相应目录、拷贝文件等工作。xp_cmdshell存贮过程是一个用来执行NT系统命令的扩展存贮过程。其语法结构如下:
xp_cmdshell {''command_string''} [, no_output]
其中command_string参数为要执行的系统命令。而选项no_output则用来指明不输出系统命令的执行结果。
在此段代码的最后,执行未指明whentype参数的sp_makewebtask存贮过程,导出当日的版面列表页面文件。使用的模板文件为list.tml。list.tml文件的代码如下:
<html>
<head><title>出版报</title></head>
<body BACKGROUND="images/WB00703_.gif">
<script>
var t=0;
</script>
<table BORDER="0" ALIGN="CENTER">
<