sp_runwebtask

Transact-SQL Reference

Transact-SQL Reference

sp_runwebtask

Executes a previously defined Web job and generates the HTML document. The task to run is identified by the output file name, by the procedure name, or by both parameters.

Note  All Web jobs are categorized as Web Assistant in the Job Categories dialog box in SQL Server Enterprise Manager. For more information, see Defining Jobs.

Syntax

sp_runwebtask [ [ @procname = ] 'procname' ]
    [ , [ @outputfile = ] 'outputfile'

Arguments

[@procname =] 'procname'

Is the name of the Web job procedure to run. The named procedure defines the query for the Web job. procname is nvarchar(128), with no default.

[@outputfile =] 'outputfile'

Is the name of the output file for the specified Web job. outputfile is nvarchar(255), with no default.

Return Code Values

0 (success) or a nonzero number (failure)

Remarks

sp_runwebtask must be executed in the same database specified in dbname of sp_makewebtask.

System administrators should not use SETUSER to test sp_runwebtask. The extended procedure does not honor the security context of the new user. To test for proper security authentication, create a temporary user ID and password. Use this temporary account to log in and test sp_runwebtask. Remove the temporary account after testing is completed.

Output produced by sp_runwebtask is the actual HTML source. You can view the source document with most word processing application.

Important  sp_dropwebtask, sp_makewebtask, and sp_runwebtask can be run only on Microsoft® SQL Server™ version 6.5 and later databases. Running these procedures on a database of an earlier version will return errors.

The SQL Server Agent must be running when a job is scheduled to run periodically. Otherwise, generation of the .htm page will not occur.

All Microsoft Windows® 95/98 Web Assistant users must have user accounts in the database being used. Use sp_adduser to add accounts to each database a user may access. When running the Windows 95/98 operating system, an on-demand task can be run only by the job owner or the system administrator.

Permissions

The user must have SELECT permissions to run the specified query used by the Web job.

Examples

This example runs a Web job by using the @outputfile of C:\Web\Myfile.html and an @procname of MYHTML.

sp_runwebtask @procname = 'MYHTML', @outputfile = 'C:\WEB\MYFILE.HTML' 

See Also

sp_dropwebtask

sp_makewebtask

System Stored Procedures