<?php
if($start <= 1) {
truncatetable('threads');
truncatetable('polls');
truncatetable('polloptions');
validid('ID', '[forum]');
}
$query = $db['source']->query("SELECT * FROM [forum] WHERE ID BETWEEN $start AND $end") or dexit("检索数据表 '{$source_tablepre}[forum]' 错误!<br>请将主题表 '{$source_tablepre}[forum]' 字段类型为 nText 的改为 Text 类型。", 'mssql');
while($t = $db['source']->fetch_assoc($query)) {
$t = array_change_key_case(daddslashes($t));
$tid = $t['ID'];
$fid = $t['forumid'];
$iconid = 0;
$typeid = 0;
$readperm = 0;
$price = 0;
$author = cutstr(htmlspecialchars(trim($t['username'])), 50);
$authorid = 0;
$subject = cutstr(htmlspecialchars(trim(@strip_tags($t['topic']))), 78);
$dateline = sqltimetounix($t['posttime']);
$lastpost = sqltimetounix($t['lasttime']);
$lastposter = cutstr(htmlspecialchars(trim($t['lastname'])), 50);
$views = $t['views'];
$replies = $t['replies'];
$displayorder = $t['deltopic'] ? '-1' : ($t['toptopic'] > 3 ? 3 : $t['toptopic']);
$highlight = 0;
$digest = $t['goodtopic'];
$rate = 0;
$blog = 0;
$poll = 0;
$attachment = 0;
$subscribed = 0;
$moderated = 0;
$closed = $t['locktopic'];
$sql1 = "INSERT INTO {$discuz_tablepre}threads (
`tid` , `fid` , `iconid` , `typeid`, `readperm`, `price`,`author` , `authorid` , `subject` , `dateline` , `lastpost` , `lastposter` , `views` , `replies` , `displayorder` , `highlight` , `digest` , `rate` , `blog` , `special` , `attachment` , `subscribed`, `moderated` , `closed`
) VALUES(
'$tid', '$fid', '$iconid', '$typeid', '$readperm', '$price', '$author', '$authorid', '$subject', '$dateline', '$lastpost', '$lastposter', '$views', '$replies', '$displayorder', '$highlight', '$digest', '$rate', '$blog', '$poll', '$attachment', '$subscribed', '$moderated', '$closed');";
if($db['discuz']->query($sql1)){
$convertedrows ++;
} else {
reportlog("无法转换主题 tid = $tid subject = '$subject',SQL 语句如下 :<br><textarea rows=\"3\" style=\"width: 100%;\">".$sql1."</textarea>");
}
$converted = 1;
$totalrows ++;
}
?>
SQL: SELECT * FROM [forum] WHERE ID BETWEEN 3 AND 3002
Errormsg: MSSQL ERROR
我的程序是版本:Discuz! 6.1.0 |