access upgrade to sqlserver (agent platform database conversion)

Published: 2018-05-08

```html

Note: Please use Microsoft Access in Office to perform the conversion. Office 2007 or later is recommended. Other third-party Office tools may not work.

1.Double-clickglobal.mdbto open theAccessdatabase-Database Tools-sqlserver

图片1.png 

 

 

2.Use an existing database-Next-dsn after the name

图片2.png


3.Selectsqlserver

图片3.png

 

4.Next-Browse,set a data source name,

e.g.test,Next,Finish

图片8.png

 

Next,select sqlserver authentication using the user-entered login id and password, and fill in the database account password

图片5.png

 

Next,check”Change the default database to”,and select the corresponding database in the drop-down box

图片7.png 

Next-Finish-OK-OK

图片6.png

 

Enter the database password,OK

图片8.png 

Click the double arrow to add all tables on the left to the right,Next-Next-Next-Finish

Wait until all tables are created in the database on thesqlserver server.

 

After the agent platform upgrades the database

Editconfig/const.asp

isdbsql=true  ' Database type

SqlUsername="xiuzhanwang"  ' Login account

SqlPassword="******"  ' Login password

SqlDatabaseName="xiuzhanwang"  ' Database name

SqlHostIP="sql.xxx.vhostgo.com"  ' Connection address

 

Then use a SQL manager or tools such as navicat for sqlserver to connect to the sqlserver database, and execute the following SQL statements to modify some field types 


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

Then remove the identity property of the r_id field in the serverroomlist table

Note: If you use the database's built-in management tool, please uncheck "Prevent saving changes that require table re-creation" in the options.

image.png



```