When access changes to SQL you need to pay attention to a few places!

Source: Internet
Author: User
Tags date datetime functions numeric access database
Access
See people sometimes ask questions in this area. So in each site summed up the former predecessors of a few ideas, take to share:



After database import, automatically add fields need to be rewritten, all numeric types need to be increased in length, preferably in decimal. All default values are lost. Mainly numeric types and date types. All now (), time (), date () is changed to GETDATE (). All DateDiff (' d ', time1, time2) are to be converted to DateDiff (day, time1, time2) It is possible that some true/false types cannot be used, to become 1/0. Note types are used by the cast (column as varchar). CursorType to be changed to 1, that is, to open the database to give the first numeric parameter is 1, otherwise the record may be incomplete. IsNull (RowName) to be changed to RowName = NULL

When the AutoNumber type in the database of access is converted, SQL Server does not set it to AutoNumber, and we need to add identity to the SQL creation statement to represent the AutoNumber! When converting, date-related fields, SQL Server defaults to smalldatetime type, we'd better turn it into a datetime, because the datetime type is larger than the smalldatetime type. Sometimes when using a smalldatetime type, the transformation fails, and when the datetime type is used, the conversion succeeds. The SQL statements that operate on the two databases are not identical, for example: "Delete * from user where id=10" is used when deleting records for an Access database, and the SQL Server database is deleted by: "Delete user where id=10 ". Date functions are not the same, in the Access database processing, you can use the date (), Time (), and other functions, but in the SQL Server database processing, only datediff,dateadd functions, but not the date (), time () and other functions. In the processing of Access database, some VB functions can be used directly in SQL statements, such as the CStr () function, but not in SQL Server database processing.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.