Places and several techniques that use SQL statements in Access

xiaoxiao2021-03-06  22

CREATE UNIQUE INDEX INAME ON TAB1 (Name); Facts in Access Display is - there is (no repetition). The following statement deletes the two index Drop Index Idate on Tab1 established; Drop Index INAME ON TAB1; Access Update statement with SQL Server comparison: Update statement of multi table in SQL Server: update tab1 set a.name = B.Name from Tab1 a, tab2 b where A.id = B.ID; the same function SQL statement in Access It should be Update Tab1 A, Tab2 B Set A.Name = B.Name WHERE A.ID = B.ID; ie: The Update statement in Access does not have a FROM clause, all referenced tables are listed after the UPDATE key. If the TAB2 can be not a table, but a query, an example: Update Tab1 A, (Select ID, Name from Tab2) B set a.name = B.Name where A.Id = B.ID; Access Multiple Different Access database - use IN clause in SQL: SELECT A. *, B. * From Tab1 A, Tab2 b in 'db2.mdb' where a.id = B.ID; the above SQL statement queries the current database Tab1 and DB2.mdb (in the current folder) all records associated with id. Disadvantages - External databases cannot with password. Access other ODBC Data Source in Access SQLSERVER in Access SQLServer SELECT * FROM Tab1 in [odbc] [odbc; driver = SQL Server; UID = SA; PWD =; server = 127.0.0.1; database = demo;] The full parameters of external data source connection properties are: [ODBC; Driver = Driver; Server = Server; Database = Database; UID = User; PWD = password;] Among them, Driver = Driver can find Access Support subqueries Access support from HKEY_LOCAL_MACHINST.INI / in the registry, but does not include complete external coupling, such as supporting Left Join or Right Join but does not support Full Date Query in Outer Join or Full Join Access Note: Date time separator in Access is # instead of quotation marks Select * from tab1 where [date]> # 2002-1 #; I am using SQL.Add in Delphi (Format ('select> #% s #;', [DATETOSTR (DATE)])); the string in Access can be separated by dual quotation marks, but SQLServer does not recognize, so in order to migrate and Compatible, it is recommended to use single quotes as a string separator.

转载请注明原文地址:https://www.9cbs.com/read-40111.html

New Post(0)