Thursday, March 1, 2012

SQL to Create Sitemap

insert into posterdata_part1
select top 50000 *  from posterdata
order by PID

insert into posterdata_part2
select top 50000 *  from posterdata
where PID>(select max(PID) from #temp_part1)
order by PID

insert into posterdata_part3
select top 50000 *  from posterdata
where PID>(select max(PID) from #temp_part2)
order by PID


insert into posterdata_part4
select top 50000 *  from posterdata
where PID>(select max(PID) from #temp_part3)
order by PID

sp_makewebtask @outputfile = 'C:\Data\Sitemap\sitemap1.xml',
    @query = 'SELECT ( select ''http://www.artgalore.ca/details.cfm?id=''+ replace(code,'' '',''%20'') as loc, ''monthly'' as changefreq, ''0.5'' as priority  from posterdata_part1 FOR XML PATH(''url''),TYPE)', 
    @templatefile = 'C:\Data\Sitemap\template.tpl'


sp_makewebtask @outputfile = 'C:\Data\Sitemap\sitemap2.xml',
    @query = 'SELECT ( select ''http://www.artgalore.ca/details.cfm?id=''+ replace(code,'' '',''%20'') as loc, ''monthly'' as changefreq, ''0.5'' as priority  from posterdata_part2 FOR XML PATH(''url''),TYPE)', 
    @templatefile = 'C:\Data\Sitemap\template.tpl'
   


sp_makewebtask @outputfile = 'C:\Data\Sitemap\sitemap3.xml',
    @query = 'SELECT ( select ''http://www.artgalore.ca/details.cfm?id=''+ replace(code,'' '',''%20'') as loc, ''monthly'' as changefreq, ''0.5'' as priority  from posterdata_part3 FOR XML PATH(''url''),TYPE)', 
    @templatefile = 'C:\Data\Sitemap\template.tpl'
   


sp_makewebtask @outputfile = 'C:\Data\Sitemap\sitemap4.xml',
    @query = 'SELECT ( select ''http://www.artgalore.ca/details.cfm?id=''+ replace(code,'' '',''%20'') as loc, ''monthly'' as changefreq, ''0.5'' as priority  from posterdata_part4 FOR XML PATH(''url''),TYPE)', 
    @templatefile = 'C:\Data\Sitemap\template.tpl'


sp_makewebtask @outputfile = 'C:\Data\Sitemap\sitemap5.xml',
    @query = 'SELECT ( select distinct ''http://www.artgalore.ca/artlist2.cfm?lname=''+ lname + ''&fname='' + fname as loc, ''monthly'' as changefreq, ''0.5'' as priority  from posterdata FOR XML PATH(''url''),TYPE)', 
    @templatefile = 'C:\Data\Sitemap\template.tpl'

No comments:

Post a Comment