SQL Server static page export Technology 2

Source: Internet
Author: User
Tags date format character set execution web database
server| Static | Page This article extracts from the Railway publishing house new "use BackOffice to establish Intranet/extranet application" (now in Haidian Book city has been sold). This book details how to use the Microsoft BackOffice family of products to build intranet/extranet applications. With it you will master the installation and setup of NT, use IIS to set up a Web site, set up a network conferencing system through ILS, create an enterprise mail and collaboration system with Exchange, build Web database applications with SQL Server, and use proxy Server establishes secure connections to the Internet, creates network TV/radio stations with Media server, builds powerful chat rooms with Chart server, builds personalized mailing lists with Site server, and analyzes access to Web sites, Use Commerce Server to establish business-to-business or business-to-consumer e-commerce sites. In addition, the book also discusses the security of the network, which guides you through a more robust and secure network application. After reading this book, you will find that the implementation of the rich and colorful network applications is so simple ...
Absolutely original, welcome to reprint. But make sure you keep the above text.


Using SQL statements to implement static page exports
First, let's look at what you want to do with the static page export technology. We are going to put the daily newspaper content in the same format as the IDC application in the corresponding catalogue on the ISP's homepage (for example, the May 8, 99 newspaper content will be placed in the 1999-05-08 catalogue). To achieve this effect, you need to export three types of files: A list page file that publishes daily pages (one per day), each page of the article List page file (how many pages per day, how many of these files), each article content is a paging file (how many articles per day, there are many such files).
sp_makewebtask storage process grammatical structure and parameter meaning:
Establishing a static page export task is done by the sp_makewebtask storage process. Let's look at the specific syntax structure and parameters:
sp_makewebtask [@outputfile =] ' outputfile ', [@query =] ' query '
[, ] [@fixedfont =] Fixedfont]
[, ] [@bold =] bold]
[, ] [@italic =] italic]
[, ] [@colheaders =] colheaders]
[, ] [@lastupdated =] lastupdated]
[, ] [@HTMLHeader =] HTMLheader]
[, ] [@username =] username]
[, ] [@dbname =] dbname]
[, ] [@templatefile =] ' TemplateFile ']
[, ] [@webpagetitle =] ' Webpagetitle ']
[, ] [@resultstitle =] ' Resultstitle ']
[
[@URL =] ' URL ', [@reftext =] ' Reftext ']
| [, ] [@table_urls =] table_urls, [@url_query =] ' url_query ']
]
[, ] [@whentype =] whentype]
[, ] [@targetdate =] targetdate]
[, ] [@targettime =] targettime]
[, ] [@dayflags =] dayflags]
[, ] [@numunits =] numunits]
[, ] [@unittype =] unittype]
[, ] [@procname =] procname]
[, ] [@maketask =] Maketask]
[, ] [@rowcnt =] rowcnt]
[, ] [@tabborder =] Tabborder]
[, ] [@singlerow =] singlerow]
[, ] [@blobfmt =] blobfmt]
[, ] [@nrowsperpage =] n]
[, ] [@datachg =] table_column_list]
[, ] [@charset =] characterset]
[, ] [@codepage =] codepage]

The following is an introduction to the parameters of the sp_makewebtask storage process:
OutputFile: Indicates the path and file name for the exported static paging file. For situations where multiple files are generated (for example, when the maximum number of records per page is limited), the system automatically adds numbers to the end of those file names.
Query: An SQL statement to be executed by the sp_makewebtask storage process. The resulting data is used to generate a static page. Similar to IDC technology, multiple queries are also allowed in this parameter.
Fixedfont: Indicates whether a fixed-width font is used (1) and is not used when 0. Default is 1).
Bold: Use bold font. (used for 1, not used for 0.) Defaults to 0)
Italic whether italic fonts are used. (used for 1, not used for 0.) Defaults to 0)
Colheaders: Whether to display the field name (the column heading of the resulting data collection). (displayed for 1 o'clock, not shown when 0.) Defaults to 1)
LastUpdated: Whether to display the creation time of the file in the page. (displayed for 1 o'clock, not shown when 0.) Defaults to 1)
HTMLheader: The display format for page titles. The value is 1~6 and corresponds to the h1~h6 of the HTML language.
Username: Indicates the user to execute the SQL statement by default to the user at the time of the connection (the default user in this application instance is editer).
dbname: Indicates which database to run the SQL statement on. The current database is assumed to be the default.
TemplateFile: Indicates the path and file name of the template file (similar to the role of the HTX file in IDC technology). If you use a template file, other formatting control parameters will no longer work (such as bold, italic, and Fixedfont parameters).
Webpagetitle: Indicates the title of the paging file, equivalent to the characters between <TITLE> </TITLE> in the HTML statement.
Resultstitle: Specifies the caption to be displayed before the result dataset is returned in the page. The default is query Results.
URL: Used to indicate a hyperlink contained in a page. Must be used in conjunction with the Reftext parameter.
The name of the hyperlink address in the Reftext:url parameter. That is, the text part of the connection address in the HTML file. As in the following example, "article query" a few words.
<a href= "SEARCH.IDC?" > Article Query </a>
Table_urls: Indicates whether to use a query to dynamically generate a list of hyperlinks in a page (1 is used and not used when 0). Default is 0). If this parameter is 1 o'clock, the URL and Reftext parameters cannot be specified at the same time, and the url_query parameters must be specified.
Url_query: The query statement used to produce a list of hyperlinks. The first word that it returns Keweiking the address, and the second field is the name of this address.
Whentype: Used to indicate the timing of a task execution. Its value and meaning are as follows:
N 1: System default value. Indicates that the task is immediately established and executed to establish an export page. and delete the task after execution.
N 2: Create the task, but do not execute it immediately. The date and time of its execution are determined by the targetdate and Targettime parameters (optional parameters) respectively. If you do not specify the Targettime parameter, the task will be performed 0 o'clock in the morning the day specified by TargetDate.
N 3: The task is performed on n days a week, and its first execution time is determined by the targetdate and Targettime parameters (optional parameters) respectively. After that, the Dayflages parameter indicates which days of the week the task will be performed.
N 4: Perform a task every n minutes, hours, days, or weeks. Its first execution time is determined by the targetdate and Targettime parameters (optional parameters) respectively. And the interval of time is indicated by numunits and UnitType parameters respectively.
N 5: The user decides when to perform this task. This task is created but not scheduled. Users can perform this task by performing sp_runwebtask.
N 6: Indicates that the task is immediately established and that it is executed to establish the export page. and executed after execution at the date and time, respectively, indicated by the targetdate and Targettime parameters (optional parameters).
N 7: Similar to 3, but it will execute once when the task is established, so no targetdate parameters are required.
N 8: Similar to 4, but it will execute once when the task is established, so no targetdate parameters are required.
N 9: Similar to 5, but it will execute once when the task is established.
N 10: Executes once when the task is established, and then executes when the data specified in the DATACHG parameter changes.
TargetDate: Indicates the date on which the task was executed (for example, the Whentype parameter is 2, 3, 4, 6 o'clock), and its format is YYYYMMDD.
Targettime: Indicates when the task was executed, in the form of HHMMSS. The default value is 0 o'clock in the morning.
Dayflags: Used to indicate which day of the week the task is to be performed (for example, the Whentype parameter is 3 or 7 o'clock). The values are 1, 2, 4, 8, 16, 32, 64, respectively, in Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday. If you want to indicate that you are performing tasks on multiple days of the week, add the values they represent. For example, to perform a task in Monday and Thursday, this parameter is equal to 18 (2+16=18).
Numunits: Used with the UnitType parameter to specify how often the task is executed (for example, the Whentype parameter is 4 or 8 o'clock). Its value range is 1~255.
UnitType: The time unit used to indicate the numunits parameter. The values can be 1, 2, 3, 4, respectively, and correspond to hours, days, weeks, and minutes. For example, when the Numunits parameter is the 1,unittype parameter is 2 o'clock, the task is executed once every two hours.
ProcName: Indicates the name of the task being established.
Maketask: Indicates whether a task is established to perform a storage process that exports a static page. The values can be as follows:
0: Establish an unencrypted storage process, but do not create a task to perform the storage process.
1: Establish an encrypted storage process and create a task to perform the storage process.
2: Establish an unencrypted storage process and create a task to perform the storage process (this value is the system default).
ROWCNT: Indicates the maximum number of records returned from the result dataset of the SQL statement. The default is to return all records.
Tabborder: Indicates whether the data in the page draws the border of the table. The value can be 1 (drawing lines) or 0 (no lines), and the default value is 1.
SingleRow: Indicates whether to create a paging file for each returned record. The value can be 1 (create a separate file) or 0 (no separate files for each record), and the default value is 0.
BLOBFMT: Indicates whether the fields of ntext and image data types in the result set returned by the query are placed independently in a paging file and a hyperlink to these files is added to the main page file. The default for this parameter is null. The format is as follows:
"%n% file=output_filename tplt=template_filename url=url_link_name ..."
where n is the ordinal number of the ntext or image field in the returned result. Output_filename the filename for the ntext and image fields, Template_filename for its template file name, url_link_name the name of the hyperlink that is attached to the file in the primary paging file.
Nrowsperpage: Indicates the maximum number of records in each paging file. The default value is 0, which means that all returned result recordsets will be placed in a single paging file. When the query returns more records than the value specified by this parameter, additional paging files are generated to place the exceeded records. And these page files contain each other hyperlink address (first page, previous page, next page, last page), you can click on these hyperlinks to complete the jump between these pages.
DATACHG: Used to indicate which fields in a table are changing, perform this task to produce a new paging file (when the whentype parameter is 10 o'clock). The syntax format is as follows:
{table= name [Column=name]} [,...]
CharSet: Indicates the character set used by the paging file. For Chinese, the value should be ' gb2312 '.
CodePage: Indicates the code page used by the paging file. For Chinese, the value should be 936.
The values for various text CharSet and codepage are as follows (you can get the following list by running the sp_enumcodepages storage process):
Code Page Character Set language
708 ASMO-708 Arabic character (asmo 708)
720 DOS-720 Arabic character (DOS)
28596 iso-8859-6 Arabic character (ISO)
1256 windows-1256 Arabic characters (Windows)
1257 windows-1257 Baltic characters (Windows)
852 ibm852 Central European character (DOS)
28592 Iso-8859-2 Central European character (ISO)
1250 windows-1250 Central European character (Windows)
936 gb2312 Simplified Chinese (GB2312)
52936 hz-gb-2312 Simplified Chinese (Hz)
950 Big5 Traditional Chinese (BIG5)
866 cp866 Cyrillic character (DOS)
28595 iso-8859-5 Cyrillic character (ISO)
20866 koi8-r Cyrillic character (Koi8-r)
21866 Koi8-ru Cyrillic character (Koi8-u)
1251 windows-1251 Cyrillic character (Windows)
28597 iso-8859-7 Greek character (ISO)
1253 windows-1253 Greek characters (Windows)
862 DOS-862 Hebrew character (DOS)
38598 Iso-8859-8-i Hebrew character (iso-logical)
28598 iso-8859-8 Hebrew character (iso-visual)
1255 windows-1255 Hebrew characters (Windows)
50932 _autodetect Japanese (auto selection)
51932 euc-jp Japanese (EUC)
932 shift_jis Japanese (shift-jis)
949 ks_c_5601-1987 Korean
874 windows-874 Thai (Windows)
1254 iso-8859-9 Turkish characters (Windows)
65001 utf-8 Unicode (UTF-8)
1258 windows-1258 Vietnamese character (Windows)
1252 iso-8859-1 Western European character
The following storage procedures are also associated with the export of static pages:
Sp_runwebtask: Used to perform a static page export task established by sp_makewebtask. Its grammatical structure is as follows:
sp_runwebtask [[@procname =] ' procname ']
[,] [@outputfile =] ' OutputFile '
Where the procname parameter indicates the name of the static page export task to be performed, and outputfile indicates the output file for the task. For example, to run the static page export task we established above, we can do this by using the following statement:
EXEC sp_runwebtask ' Test Web Page '
Sp_dropwebtask: Deletes the established static page export task. Its grammatical structure is as follows:
sp_dropwebtask {[@procname =] ' procname ' | [, @outputfile =] ' OutputFile '}
Where the procname parameter indicates the name of the static page export task to be deleted. OutputFile, however, indicates the export file you want to delete. If you want to delete the static page export task that we established above, complete the following statement:
EXEC sp_dropwebtask ' Test Web Page ', ' D:\test\cbb\ttt.htm '


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.