Apply Div Tag In Stored Procedure Using SQL Server To Add Body , Header , Footer Text Details In Pages And Reports Dynamically


The <div> tag is used to group block the elements to format them.

Here, I have added div tag in the stored procedure, as I had used in ASP.NET html. Retrieve Footer and Header text information in page or report, using dynamic process instead of static process.


In real time scenarios, instead of writing page header and footer and other text details, manually or static process
in ASPX page or Report like rdl ,rdlc, rpt.;  we can retrieve those, using backend processes.


Create a table and insert some dummy records in it.

Execute the query given below to show the records.
  1. select * from tblEmployees 
Create a stored procedure, as shown below. 
  1. Create Procedure Sp_DivTag  
  2. As  
  3. Begin  
  4. Set nocount on;  
  5. SELECT  tblEmployees.ID as EmployeeID,'<div align="justify">This is to inform that '+  
  6.             ', 'case when tblEmployees.Gender='male' then 'Mr.'  + tblEmployees.Name else 'Mrs.'  + tblEmployees.Name end   
  7.             +', is a member of our Company , working in the Microsoft Platform'+  
  8.             +'</p></div>' as MemberBIO  
  9.             FROM tblEmployees  
  10. End   
Here, I used div tag, put some case statement for male and female employee details and put alias as 'MemberBIO'
by using this alias as 'MemberBIO' and putting this in ASPX and report, as mentioned above and retrieving the text details from the backend process instead of writing manually or static process.
Execute the procedure given below.
  1. exec Sp_DivTag 

What is a div tag?
How to apply a div tag in the stored procedure.
Merits of using div tag.
Apply it in Pages and Reports.