ACC: How to Query SQL Server Tables Without Linking/AttachingLast reviewed: May 20, 1997Article ID: Q101375 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. This article describes how to use the SQL IN clause to query an SQL Server table without linking (attaching) it.
MORE INFORMATIONYou can use IN to query only one external database at a time. The IN clause requires two arguments: database name and connect string. When you link SQL Server tables, you must specify an empty string for the database name. The connect string consists of the following items:
Data Source Name (DSN) The name of the SQL Server computer Database Name (DATABASE) The name of the SQL Server database Workstation ID (WSID) The name of the workstation that is making the connection (optional) User ID (UID) The login ID* Password (PWD) The user password* * This item is optional within the connect string. If it is not present, the system prompts the user with a dialog box to enter this information the first time the macro is executed each session.The following is a sample connect string to SQL Server. Note that it starts with "ODBC," which tells the system that it uses the ODBC driver (as opposed to an installable ISAM driver).
ODBC;DSN=ServerName;Database=Pubs;WSID=Wrk1;USID=JaneDoe;PWD=ABC123The following example assumes that the ODBC driver manager and SQL Server driver are installed, that a data source called "Corp" was set up using the ODBC driver manager, and that the table "authors" can be successfully linked from the database Pubs, using the Get External Data/Link Tables commands on the File menu (or Attach Table command on the File menu in versions 1.x and 2.0).
REFERENCESFor more information using Microsoft Access as a front end, search for "SQL," and then " SQL Databases" using the Microsoft Access for Windows 95 Help Index. For more information about the IN clause, search for "IN (SQL)," and then "IN Clause (SQL)" using the Microsoft Access for Windows 95 Help Index.
|
Additional query words: attach remote data source
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |