Wikipedia:List of pages in the Wikipedia namespace/How to update

#use at your own risk. No warranty implied or given.
#please debug and improve.

DROP TABLE IF EXISTS `lindex`;

CREATE TABLE `lindex` (`s_title` varchar(255) binary NOT NULL default '') TYPE=MyISAM;

INSERT INTO `lindex` VALUES ('! 0123 ..');
INSERT INTO `lindex` VALUES ('A ..');
INSERT INTO `lindex` VALUES ('B ..');
INSERT INTO `lindex` VALUES ('D ..');
INSERT INTO `lindex` VALUES ('E ..');
INSERT INTO `lindex` VALUES ('H ..');
INSERT INTO `lindex` VALUES ('M ..');
INSERT INTO `lindex` VALUES ('N ..');
INSERT INTO `lindex` VALUES ('O ..');
INSERT INTO `lindex` VALUES ('S ..');
INSERT INTO `lindex` VALUES ('V ..');
INSERT INTO `lindex` VALUES ('W ..');
INSERT INTO `lindex` VALUES ('X YZ ..');
INSERT INTO `lindex` VALUES ('Announcements');
INSERT INTO `lindex` VALUES ('Dewey Decimal System');
INSERT INTO `lindex` VALUES ('List of encyclopedia topics');
INSERT INTO `lindex` VALUES ('Multiple-place names');
INSERT INTO `lindex` VALUES ('Naming conventions');
INSERT INTO `lindex` VALUES ('Requests for comments');
INSERT INTO `lindex` VALUES ('Upload log');
INSERT INTO `lindex` VALUES ('Village pump');
INSERT INTO `lindex` VALUES ('Wikipedians');
INSERT INTO `lindex` VALUES ('WikiProject');

DROP TABLE IF EXISTS tempwpindex;

CREATE TABLE tempwpindex 
	(SELECT 
		s_title, 
		0 AS B, 
		CONCAT('==',s_title,'==') AS Wikipedia_index 
	FROM lindex)
UNION
	(SELECT
		cur_title,
		1,
		CONCAT('*([[Wikipedia talk:', 
				cur_title, 
				'|talk]]) [[Wikipedia:', 
				REPLACE(cur_title,'_',' '), 
				']]'
			) AS Wikipedia_index
 	FROM cur 
	WHERE cur_namespace=4 
	AND cur_is_redirect=0
	AND cur_title NOT LIKE '%log_archive%'
	LIMIT 10000 )
ORDER BY 
	s_title, 
	B, 
	Lower(Wikipedia_index)
LIMIT 10000;


SELECT Wikipedia_index
INTO OUTFILE 'wp:\wpwpindex.txt'
FROM tempwpindex
LIMIT 10000;


DROP TABLE IF EXISTS tempwpindex;