access升遷sqlserver(代理平臺數據庫轉換)
- 威海服務器/VPS 威海SQL Server
- 1335
注意:請使用office的microsoft access進行轉換,推薦office 2007以上版本 。其他第三方office工具可能無法操作。
1.雙擊global.mdb打開access數據庫-數據庫工具-sqlserver
圖片1.png
2.使用現有數據庫-下一步-dsn名稱后
圖片2.png
3.選擇sqlserver
圖片3.png
4.下一步-瀏覽,設置一個數據源名稱,
如test,下一步,完成
圖片8.png
下一步,選擇使用用戶輸入登陸id和密碼的sqlserver驗證,填寫數據庫帳號密碼
圖片5.png
下一步,勾選”更改默認的數據庫為”,并在下拉框中選擇對應數據庫
圖片7.png
下一步-完成-確定-確定
圖片6.png
輸入數據庫密碼,確定
圖片8.png
點擊雙箭頭將左側所有表都添加到右側,下一步-下一步-下一步-完成
等待所有表都創建到sqlserver服務器的數據庫中即可
代理平臺升級數據庫后
編輯config/const.asp
isdbsql=true ' 數據庫類型
SqlUsername="xiuzhanwang" ' 登陸帳號
SqlPassword="******" ' 登陸密碼
SqlDatabaseName="xiuzhanwang" ' 數據庫名稱
SqlHostIP="sql.xxx.vhostgo.com" ' 連接地址
然后用sql管理器或者navicat for sqlserver等工具連接sqlserver數據庫,執行以下sql語句修改部分字段類型
image.png
alter table countlist alter column c_memo nvarchar(MAX)
alter table productlist alter column p_name nvarchar(MAX)
alter table producttype alter column pt_memo nvarchar(MAX)
alter table protofree alter column freeproid1 nvarchar(MAX)
alter table ActionLog alter column Remark nvarchar(MAX)
alter table ActionLog alter column Remark nvarchar(MAX)
alter table cache_app alter column value nvarchar(MAX)
alter table domaintrans alter column whoisbody nvarchar(MAX)
alter table Free alter column f_content nvarchar(MAX)
alter table HostRental alter column Memo nvarchar(MAX)
alter table HostRental alter column weihulist nvarchar(MAX)
alter table mailsitelist alter column m_agent nvarchar(MAX)
alter table ShopCart alter column addtime datetime
alter table ShopCart ADD DEFAULT getdate() for addtime
alter table UserDetail ADD DEFAULT getdate() for u_regdate
alter table UserDetail ADD DEFAULT 0 for u_resumesum
alter table UserDetail ADD DEFAULT 0 for u_usemoney
alter table UserDetail ADD DEFAULT 0 for u_Invoice
alter table UserDetail ADD DEFAULT 0 for u_remcount
alter table UserDetail ADD DEFAULT 0 for u_borrormax
alter table countlist ADD DEFAULT 0 for u_in
update UserDetail set u_resumesum=0 where u_resumesum is null
update UserDetail set u_usemoney=0 where u_usemoney is null
update UserDetail set u_Invoice=0 where u_Invoice is null
update userdetail set u_remcount=0 where u_remcount is null
update userdetail set u_borrormax=0 where u_borrormax is null
update countlist set u_in=0 where u_in is null
set identity_insert serverroomlist ON
再取消serverroomlist 表r_id字段的標識
注意:您如果使用數據庫自帶管理工具,請在選項中取消阻止保存要求重新創建表的更改
image.png
來源:西部數碼