简体   繁体   中英

Google Sitemap Script for SQL Server needs to be converted to Access Database Script

I usually do everything in SQL Server these days, however, I have a site that is just so small, that it is going to be using an Access database.

This is the code that I am using to generate the Google Sitemap with, however, there is code here that does not translate over to ACCESS Database.

SELECT imageid, imagetitle, MedUpdate as DefaultTime, convert(varchar(11),MedUpdate,121) as UModDate, 
       CONVERT(CHAR(8), CONVERT(DATETIME, MedUpdate, 113), 114) AS UMilTime,
       CONVERT(varchar(11),MedDate,121) as JDate, CONVERT(CHAR(8), CONVERT(DATETIME, MedDate, 113), 114) AS JTime 
FROM Images 
GROUP BY imageid, MedUpdate, MedDate, imagetitle 
ORDER BY imageid

Could someone please assist me in converting this over to a working ACCESS Query please?

OK. It was right easy, took about 5 minutes to make up the script, once I got my heard wrapped around it.

So. For those that are needing to make a Sitemap to work with Google Webmaster Tools, and you just perhaps are using Access Database, for a small site, then this is the code that you will want to use.

A little explaination of what we have going on here.

  1. You have 2 DateTime Columns.
  2. One is for the Insert Date.
  3. One is for the Update Date. (This is when you update the page, and you insert a new date into the database, if will pick up on it.)

    SELECT ImageID, MedUpdate as DefaultTime, format(MedDate,'YYYY-MM-DD') as UModDate, format(MedDate,'hh:mm:ss') AS UMilTime,
    format(MedUpdate,'YYYY-MM-DD') as JDate, format(MedUpdate,'hh:mm:ss') AS JTime FROM Images;

Hope this helps Wayne Barron

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM