Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to transform parameters to sp_makewebtask for title display? 1

Status
Not open for further replies.

royc75

Programmer
Jun 1, 2006
127
GB
Hello,

I am using sp_makewebtask SP in order to export query results to HTML. The query results are based onm some parameter available at the SP the uses sp_makewebtask.
My question is: I woulk like to use these parameters as a Title of the generated HTML file. Is it possible to transfer them to the sp_makewebtask and "plant" them at the HTML template file? If yes, how do I do that?
 
Brief look at Books Online shows a parameter for the page <TITLE>, @webpagetitle . Why not build a string from the relevant parameters of your stored procedure and call the system stored proc with the appropriate value?

Code:
CREATE PROCEDURE show_my_data_as_web_page (
   @fun VARCHAR(50),
   @games VARCHAR(50)
)

DECLARE @myPageTitle VARCHAR(100)
SET @myPageTitle = @fun + @games

EXECUTE sp_makewebtask @webpagetitle = @myPageTitle, etc
 
Hi,

This title will be inserted at the <TITLE> Tag as far as I know.
I would like to use it as an actual title inside the HTML Like this:
<BODY>
<H1> My title is: @someParam1 And @someParam2 </H1>
</BODY>
 
Spending a few more minutes reading Books Online I found a couple of things to try.

There are parameters for @HTMLheader and @resultstitle which it seems would be placed just above the results of the query.
Code:
DECLARE @myResultHeader VARCHAR(100)
SET @myResultHeader = 'My title is: ' + @fun + ' And ' + @games

EXECUTE sp_makewebtask @resultstitle = @myResultHeader, 
                       @HTMLheader = 1, etc

Or it is possible to provide multiple recordsets to sp_makewebtask and specify their locations in the template by placing multiple <%insert_data_here%> tags where desired.
So you could have a query for the header and a second one for the actual results. The query for the header might be
Code:
SELECT '<h1>My title is: ' + @fun + ' And ' + @games + '</h1>'

The corresponding <%insert_data_here%> could be placed anywhere in the template. At least that is how I read it.

There are really good examples in the Books Online for this stored procedure.
 
10X it sounds like a good solution.
One question though: How do I transfer the SELECT '<h1>My title is: ' + @fun + ' And ' + @games + '</h1>' as a string to the @query parameter when I have one more query involved over there?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top