我已经为此工作了几个小时,并且处于困境中。如果可以的话请帮助我,我将不胜感激...
我正在尝试将一系列 mysql 语句转换为 sql server 2008 express,用于小型 wordpress 数据库迁移项目。我不是 MS SQL 数据库的专家...
我已经转换了大部分语句,但在如何处理 mySQL 语句底部附近的表索引语句方面需要帮助。如何将它们转换为 SQL Server 兼容语句?:
mySQL 语句:
DROP TABLE IF EXISTS `wp_pollsip`;
CREATE TABLE IF NOT EXISTS `wp_pollsip` (
`pollip_id` int(10) NOT NULL AUTO_INCREMENT,
`pollip_qid` varchar(10) NOT NULL DEFAULT '',
`pollip_aid` varchar(10) NOT NULL DEFAULT '',
`pollip_ip` varchar(100) NOT NULL DEFAULT '',
`pollip_host` varchar(200) NOT NULL DEFAULT '',
`pollip_timestamp` varchar(20) NOT NULL DEFAULT '0000-00-00 00:00:00',
`pollip_user` tinytext NOT NULL,
`pollip_userid` int(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`pollip_id`),
KEY `pollip_ip` (`pollip_id`),
KEY `pollip_qid` (`pollip_qid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- Dumping data for table .wp_pollsip: ~5 rows (approximately)
DELETE FROM `wp_pollsip`;
/*!40000 ALTER TABLE `wp_pollsip` DISABLE KEYS */;
INSERT INTO `wp_pollsip` (`pollip_id`, `pollip_qid`, `pollip_aid`, `pollip_ip`, `pollip_host`, `pollip_timestamp`, `pollip_user`, `pollip_userid`) VALUES
(1, '1', '1', '11.11.11.11', 'isp-here', '1344836172', 'admin', 1),
(2, '2', '6', '11.11.11.11', 'isp-here', '1344836700', 'admin', 1),
(3, '3', '9', '11.11.11.11', 'isp-here', '1344963379', 'Guest', 0),
(4, '4', '12', '11.11.11.11', 'isp-here', '1345136711', 'admin', 1),
(5, '4', '14', '11.11.11.11', 'isp-here', '1345171584', 'Guest', 0);
/*!40000 ALTER TABLE `wp_pollsip` ENABLE KEYS */;
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
MS SQL,到目前为止:
-- Dumping structure for table .wp_pollsip
IF OBJECT_ID('wp_pollsip','U') IS NOT NULL DROP TABLE wp_pollsip;
CREATE TABLE wp_pollsip (
pollip_id bigint NOT NULL IDENTITY,
pollip_qid varchar(10) NOT NULL DEFAULT '',
pollip_aid varchar(10) NOT NULL DEFAULT '',
pollip_ip varchar(100) NOT NULL DEFAULT '',
pollip_host varchar(200) NOT NULL DEFAULT '',
pollip_timestamp varchar(20) NOT NULL DEFAULT '0000-00-00 00:00:00',
pollip_user char(256) NOT NULL,
pollip_userid int NOT NULL DEFAULT '0',
--PRIMARY KEY (pollip_id),
--KEY pollip_ip (pollip_id),
--KEY pollip_qid (pollip_qid)
);
-- Dumping data for table .wp_pollsip: ~5 rows (approximately)
DELETE FROM wp_pollsip;
/*!40000 ALTER TABLE wp_pollsip DISABLE KEYS */;
INSERT INTO wp_pollsip (pollip_qid, pollip_aid, pollip_ip, pollip_host, pollip_timestamp, pollip_user, pollip_userid) VALUES
('1', '1', '11.11.11.11', 'isp-here', '1344836172', 'admin', 1),
('2', '6', '11.11.11.11', 'isp-here', '1344836700', 'admin', 1),
('3', '9', '11.11.11.11', 'isp-here', '1344963379', 'Guest', 0),
('4', '12', '11.11.11.11', 'isp-here', '1345136711', 'admin', 1),
('4', '14', '11.11.11.11', 'isp-here', '1345171584', 'Guest', 0);
/*!40000 ALTER TABLE wp_pollsip ENABLE KEYS */;
我希望这是有道理的,谢谢。