Using ASP Classic, we can create a Sitemap with XML that we can use with Google, Bing, and other search engines and Data-hungry sites to show updated content to your visitors. Using XML, there are no limits to what you can accomplish once you get started.
Live Lessons Example - ASP Classic Create an XML Sitemap or data feed
[Virtual-Class-01]
CFFCS | CarrzSynEdit: | SQL Script
-- Create a new database called [Virtual-Class-01] in SQL Server.

-- Right-click and choose [New Query]

-- Copy and paste the code below and hit [Execute]


USE [Virtual-Class-01]
GO
/****** Object:  Table [dbo].[XMLSitemap]    Script Date: 7/8/2022 5:17:13 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[XMLSitemap](
	[XMLID][int] IDENTITY(1,1) NOT NULL,
	[XMLTitle][nvarchar](50) NOT NULL,
	[XMLTime][datetime] NULL,
 CONSTRAINT [PK_XML] PRIMARY KEY CLUSTERED 
(
	[XMLID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[XMLSitemap] ON 
GO
INSERT [dbo].[XMLSitemap] ([XMLID], [XMLTitle], [XMLTime]) VALUES (1, N'One', CAST(N'2022-07-08T17:16:57.743' AS DateTime))

GO
INSERT [dbo].[XMLSitemap] ([XMLID], [XMLTitle], [XMLTime]) VALUES (2, N'Two', CAST(N'2022-07-08T17:16:57.743' AS DateTime))

GO
INSERT [dbo].[XMLSitemap] ([XMLID], [XMLTitle], [XMLTime]) VALUES (3, N'Three', CAST(N'2022-07-08T17:16:57.743' AS DateTime))

GO
INSERT [dbo].[XMLSitemap] ([XMLID], [XMLTitle], [XMLTime]) VALUES (4, N'Four', CAST(N'2022-07-08T17:16:57.743' AS DateTime))

GO
INSERT [dbo].[XMLSitemap] ([XMLID], [XMLTitle], [XMLTime]) VALUES (5, N'Five', CAST(N'2022-07-08T17:16:57.743' AS DateTime))

GO
INSERT [dbo].[XMLSitemap] ([XMLID], [XMLTitle], [XMLTime]) VALUES (6, N'Six', CAST(N'2022-07-08T17:16:57.743' AS DateTime))

GO
INSERT [dbo].[XMLSitemap] ([XMLID], [XMLTitle], [XMLTime]) VALUES (7, N'Seven', CAST(N'2022-07-08T17:16:57.743' AS DateTime))

GO
INSERT [dbo].[XMLSitemap] ([XMLID], [XMLTitle], [XMLTime]) VALUES (8, N'Eight', CAST(N'2022-07-08T17:16:57.743' AS DateTime))

GO
SET IDENTITY_INSERT [dbo].[XMLSitemap] OFF
GO
ALTER TABLE [dbo].[XMLSitemap] ADD  CONSTRAINT [DF_XMLSitemap_XMLTime]  DEFAULT (getdate()) FOR [XMLTime]
GO

[ACN.asp]
CFFCS | CarrzSynEdit: | ASP/VBScript
<%
getServer = "sqlcorecs-01"
getInstance = "sql2019"
getID = "testuser"
getPW = "testuser"
csurl = "demo.cffcs.com"

Set objConn = CreateObject("ADODB.Connection")
objConn.Open("Provider=SQLOLEDB; Data Source="&getServer&"\"&getInstance&"; Initial Catalog=Virtual-Class-01;User ID="&getID&";Password="&getPW&";")
%>

[XML.asp]
CFFCS | CarrzSynEdit: | ASP/VBScript
<!--#include file="ACN.asp"-->
<% Response.ContentType="application/xml" %><?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><%Set getXML=CreateObject("ADODB.Command")
getXML.ActiveConnection=objConn
getXML.Prepared = true
getXML.commandtext = "SELECT XMLTime, XMLID, XMLTitle FROM XMLSitemap"
set rsXML = getXML.execute%><%
%><%while not rsXML.eof%>
<url>
  <loc><%=rsXML("XMLTitle")%></loc>
  <lastmod><%=rsXML("XMLTime")%></lastmod>
  <priority>0.4</priority>
</url><%rsXML.movenext
wend
'close and free our recordset and our database connection

rsXML.close
Set rsXML = nothing
objConn.close
Set objConn = nothing%></urlset>

Other Articles Related to this Entry.