First, after the ACCESS database is imported to SQL, the primary keys of each table need to be reset, because the primary keys will be dropped during the import. Then, the primary key needs to be set to auto-increment.
Second, replace the connection string with the connection method of the SQL database. I am used to this method (connectionstring = "driver = {SQL Server}; server =" & host &"; database = "& database &"; uid = "& uid &"; Pwd = "& password &";")
Const host = "(local )"
Const database = "database name"
Const uid = "sa"
Const Password = ""
Third, after converting access to SQL, pay attention to the (yes/no) type field (ACCESS) and convert it to the bit type after SQL. Therefore, when istrue = true/false is used in the program, it is noted that the SQL database uses 1/0
If you have mentioned anything else, you need to pay more attention to it.
1. When the automatic numbering type in the ACCESS database is converted, SQL server does not set it to the automatic numbering type. We need to add the identity in the SQL creation statement to indicate the automatic numbering!
2. During conversion, SQL Server defaults to the smalldatetime type for date-related fields. We recommend that you change it to the datetime type because the datetime type has a larger range than the smalldatetime type. In this case, if the smalldatetime type is used, the conversion fails. If the datetime type is used, the conversion is successful.
3. the SQL statements used to operate these two databases are not all the same. For example, when you delete a record in an Access database, use: "delete * from user where id = 10 ", to delete an SQL Server database, use: "delete user where id = 10 ".
4. Date functions are different. In the ACCESS database processing, functions such as date () and time () can be used,
In SQL Server database processing, only functions such as datediff and dateadd can be used, instead of functions such as date () and time.
5. For Access database processing, some VB functions can be used in SQL statements, such as CSTR () functions, but not in SQL Server database processing.
I. First of all, I am talking about the conversion between Access2000 and SQL2000. I have not tried any other products yet. I hope you can experiment more and find a solution;
Ii. Conversion Method
1. Open "database source" in "Management Tools" under "Control Panel";
2. Press "add" to add a new data source, and select "Driver do Microsoft Access (*. MDB) ", a box will appear, enter the name you want to write in" database source ", I name it" ABC ", it means no need to fill in, then, find your database address and select the address (Note: Back up your own access database first), and then confirm. The data source is created here, and the conversion is left.
3. Open SQL2000 Enterprise Manager, enter the database, and create an empty Database "ABC ";
4. Select the new database, right-click the database, select "import data" under "all tasks", and click "Next;
5. Select "Driver do Microsoft Access (*. MDB) ", in" User/system DSN ", select the" ABC "you just added and press" Next ";
6. The "destination" does not need to be modified. You can select a server (generally "local" for your local machine) or a server address or LAN address, determine whether your permissions can be operated.) "using Windows Identity Authentication" means using your system administrator identity. "using SQL Identity Authentication" can be used for website operations, the latter is recommended;
7. After selecting "use SQL authentication", enter your username and password. I chose the default system number "sa ","****", select the newly created "ABC" and click "Next ";
8. Select "Copy table and view from data source" and "use a query command to specify the data to be transmitted", select the former, and press "Next" to continue;
9. The ACCESS database table will appear here. Press "select all" and then click "Next;
10. In the "DTS import/export wizard", see "Run now" and press "Next ",
11. Press "finish" to continue;
12. In this step, you will see that your data has been imported into SQL2000. When "XXX tables have been successfully imported into the database" appears, in addition, if there is a green check in front of all tables, it means that all data is successfully imported. If there is a problem in the middle or there is a red cross in front of the table, it means that the table has not been imported successfully, in this case, you have to go back and check whether your operations are correct.
3. data modification
1. Because SQL2000 does not contain "auto number", all fields you set with "auto number" will become non-empty fields, which must be manually modified, and select "yes" for his "label", the seed is "1", and the increment is "1 ",
2. In addition, after Access2000 is converted to SQL2000, the field with the original attribute "yes/no" will be converted to a non-empty "bit ", at this time, you must modify it to the desired attribute;
3. Pay attention to the time function. there are many differences between access and SQL. this must be implemented slowly from the program, because access and SQL Server are different in some SQL statements, but most of them can still be used.
At the same time, when you convert the Acess database to SQL Server, some data types will change. In addition, the data of the previous automatic encoding type must be set as the ID seed. Otherwise, an error will occur. It is easy to change, but we certainly cannot find the information you sent anonymously. Let's just talk about it. Respondent: it may be a little different. as for how to import it, I will not talk about it. it seems that automatic + 1 can be implemented in access. for example, the original ID = 6000, now I add a row, in ASP do not need to write id = ID + 1. however, in ASP connected to SQL, you need to write such a statement,
There is still a time problem, that is, they display different formats. in this way, the format originally stored in access is not necessarily displayed normally in SQL. in addition, after ASP connects to SQL, the data () statement will be modified.
Yes or no.
That's all.
The connection must be changed.