Home Topics Access Syntax comparison between access and sql server

Syntax comparison between access and sql server

Feb 20, 2021 pm 01:39 PM
access sql server grammar

Syntax comparison between access and sql server

This article briefly summarizes the syntactic differences between access and sql server. I hope it will be helpful to everyone.

1. Differentiated functions and solutions

The functions in the solution shown below are defined in the method of the TAdoConn class in the untDataBase unit.

Syntax comparison between access and sql server

2. Database functions and keyword lists that are partially the same between Access and SQLSERVER

1. Functions

Syntax comparison between access and sql server

2. Keywords

Syntax comparison between access and sql server

3. The difference in statement syntax between Access and statement SqlServer

1. Inser Into…..Select…From statement:

The following statement in ACCESS

Insert INTO

PubSubJectAccCopys(Copy_id,Acc_id,Acc_Pid,Acc_name,acc_short,Acc_Comment,Acc_Pro,acc_type,Sub_id_flag,acc_index) (Select 200201, Acc_id,Acc_Pid,Acc_name,acc_short,Acc_Comment,Acc_Pro,acc_type,Sub_id_flag,acc_index FROM PubSubJectAcc Where PubSubJectAcc.co_type='03')

中后"(select 200201******.co_Type=' 03')" must be removed to execute, as follows:

Insert INTO

PubSubJectAccCopys(Copy_id,Acc_id,Acc_Pid,Acc_name,acc_short, Acc_Comment,Acc_Pro,acc_type,Sub_id_flag,acc_index) Select 200201,Acc_id,Acc_Pid,Acc_name,acc_short,Acc_Comment,Acc_Pro,acc_type,Sub_id_flag,acc_index FROM PubSubJectAcc Where PubSubJectAcc.co_type='03'

In SQL SERVER Medium All are OK

2. Inner Join statement 1

StrSql:='select a.user_id,a.user_opcode,b.copy_name from sysuser a inner join (syscopysuser c inner join syscopys b on c .copy_id=c.copy_id) on a.user_id=c.user_id where

a.user_opcode=''' EdtUserOpCode.text ''' And copy_name=''' Tmpcopyname '''';

should be changed to

StrSql:='select a.user_id,a.user_opcode,b.copy_name from sysuser a inner join (syscopysuser c inner join syscopys b on c.copy_id=d.copy_id) on a.user_id=c.user_id where

a.user_opcode=''' EdtUserOpCode.text ''' And copy_name=''' Tmpcopyname '''';

Retrieval of this line of code Condition error: C.copy_id=C.Copy_id should be changed to c.copy_id=d.copy_id

Note: Both writing methods can run in SQL-SERVER, but c.copy_id=C.copy_id is Cannot run in ACCESS

3. Inner Join statement 2

StrSql:='select copy_year,copy_name,a.copy_id from SysCopys a inner join SysCopysUser b on a.curcopy_flag=1 and a. copy_id=b.copy_id where b.user_id=' '''' TmpPubUserID '''';

This is

StrSql:='select copy_year,copy_name,a.copy_id from SysCopys a inner join SysCopysUser b on a.copy_id=b.copy_id where a.curcopy_flag=''1'' and b.user_id=' '''' TmpPubUserID '''';

Note: Both writing methods are It can run in SQL-SERVER, but the first one cannot run in ACCESS

4. Inner Join statement 3

The following statement can be executed in SQl server

'Select distinct sysoption.opti_id,sysoption.opti_name,sysoption.opti_code,sysroleoption.opti_sort From sysoption inner join sysroleoption ON sysoption.opti_id=sysroleoption.opti_id AND sysroleoption.role_id=:roleid'

But not in ACCESS, only

'Select distinct sysoption.opti_id,sysoption.opti_name,sysoption.opti_code,sysroleoption.opti_sort From sysoption inner join sysroleoption ON sysoption.opti_id=sysroleoption.opti_id Where sysroleoption.role_id=:roleid'

5. Update statement

Can be executed in Sql SerVer but not in Access

'Update sysuserrole SET sysuserrole.role_sort = (Select sysrole.role_sort FROM sysrole Where sysuserrole.role_id = sysrole.role_id and sysuserrole.user_id='01')'

6. Date comparison

Used in SQL SERVER

StrSql:='select copy_year,Start_month,Cur_month,Start_Flag,Start_date, End_date '

'From SysCopys '

'where copy_id=''' LoginCopyID ''' '

'and start_date

'and end_date>=''' datetostr(LoginDate) '''';

Used in ACCESS

StrSql:='select copy_year,Start_month,Cur_month ,Start_Flag,Start_date,End_date '

'From SysCopys '

'where copy_id=''' LoginCopyID ''' '

'and start_date

'and end_date>=#' datetostr(LoginDate) '#'

Refer to the 10th function "GetDateStr" above

7. Maximum value acquisition statement

StrSql:='insert into sysRoleOption '

'select ''' fidRoleId ''' as Role_ID,opti_id,'

'convert(numeric,opti_id)-(convert(numeric,opti_parentid)*100) ' MaxOptiSort

' as opti_Sort from sysoption where opti_parentid= '''

PCoTypeID(self.trvRoles.Selected.data)^.StrCoTypeID

''' and opti_bottom=''1' '''';

Change for

StrSql:='insert into sysRoleOption '

'select ''' fidRoleId ''' as Role_ID,opti_id,'

'opti_id-opti_parentid*100 ' MaxOptiSort

' as opti_sort from sysoption where opti_parentid='''

PCoTypeID(self.trvRoles.Selected.data)^.StrCoTypeID

''' and opti_bottom='' 1' ''''

Note: Both writing methods can be run in SQL-SERVER, but the first one cannot be run in ACCESS

But consider that Null values ​​and statements will appear For versatility, you can use the 07th function "GetNullStr" and the 09th function "GetConvertStr" above to complete the conversion of strings to numbers, null values ​​and 0 numbers: refer to the GetNextNumStr code.

1. As cannot be omitted in Sql
2. Only one Sql can be executed at a time
3. There are no substring, cast and other functions
4. Strictly distinguish between integer and character types in SQL
5. No stored procedures or triggers
6.! = is replaced with
7. Add # signs on both sides of the time string
8. In the sql statement with parameters, replace @ with ? sign

Related recommendations: access database tutorial

The above is the detailed content of Syntax comparison between access and sql server. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to convert deepseek pdf How to convert deepseek pdf Feb 19, 2025 pm 05:24 PM

DeepSeek cannot convert files directly to PDF. Depending on the file type, you can use different methods: Common documents (Word, Excel, PowerPoint): Use Microsoft Office, LibreOffice and other software to export as PDF. Image: Save as PDF using image viewer or image processing software. Web pages: Use the browser's "Print into PDF" function or the dedicated web page to PDF tool. Uncommon formats: Find the right converter and convert it to PDF. It is crucial to choose the right tools and develop a plan based on the actual situation.

How to read dbf file in oracle How to read dbf file in oracle May 10, 2024 am 01:27 AM

Oracle can read dbf files through the following steps: create an external table and reference the dbf file; query the external table to retrieve data; import the data into the Oracle table.

Interpretation of Botanix: decentralized BTC L2 for network asset management (with interactive tutorial) Interpretation of Botanix: decentralized BTC L2 for network asset management (with interactive tutorial) May 08, 2024 pm 06:40 PM

Yesterday, BotanixLabs announced that it has completed a total of US$11.5 million in financing, with participation from Polychain Capital, Placeholder Capital and others. Financing will be used to build the decentralized EVM equivalent of BTCL2Botanix. Spiderchain combines the ease of use of EVM with the security of Bitcoin. Since the testnet went live in November 2023, there have been more than 200,000 active addresses. Odaily will analyze Botanix’s characteristic mechanism and testnet interaction process in this article. Botanix According to the official definition, Botanix is ​​a decentralized Turing-complete L2EVM built on Bitcoin and consists of two core components: Ethereum Virtual Machine

How to solve access violation error How to solve access violation error May 07, 2024 pm 05:18 PM

Access Violation error is a run-time error that occurs when a program accesses a memory location beyond its memory allocation, causing the program to crash or terminate abnormally. Solutions include: checking array boundaries; using pointers correctly; using appropriate memory allocation functions; freeing freed memory; checking for memory overflows; updating drivers and systems; checking third-party libraries; using a debugger to trace execution; contacting the software vendor for support.

How to enable remote desktop control in Win11_How to enable remote desktop control in Win11 How to enable remote desktop control in Win11_How to enable remote desktop control in Win11 May 08, 2024 pm 12:19 PM

1. Search for the Control Panel page in the Start menu. 2. Then change the view to Category in the control panel and click System and Security. 3. Find and click the Allowremoteaccess button under System. 4. In the pop-up window, click the Remote system properties column, check the Allow remote connection to this computer button and click OK to save.

How to solve the problem of third-party interface returning 403 in Node.js environment? How to solve the problem of third-party interface returning 403 in Node.js environment? Mar 31, 2025 pm 11:27 PM

Solve the problem of third-party interface returning 403 in Node.js environment. When we use Node.js to call third-party interfaces, we sometimes encounter an error of 403 from the interface returning 403...

Laravel Redis connection sharing: Why does the select method affect other connections? Laravel Redis connection sharing: Why does the select method affect other connections? Apr 01, 2025 am 07:45 AM

The impact of sharing of Redis connections in Laravel framework and select methods When using Laravel framework and Redis, developers may encounter a problem: through configuration...

What are the benefits of multithreading in c#? What are the benefits of multithreading in c#? Apr 03, 2025 pm 02:51 PM

The advantage of multithreading is that it can improve performance and resource utilization, especially for processing large amounts of data or performing time-consuming operations. It allows multiple tasks to be performed simultaneously, improving efficiency. However, too many threads can lead to performance degradation, so you need to carefully select the number of threads based on the number of CPU cores and task characteristics. In addition, multi-threaded programming involves challenges such as deadlock and race conditions, which need to be solved using synchronization mechanisms, and requires solid knowledge of concurrent programming, weighing the pros and cons and using them with caution.

See all articles