Microsoft KB Archive/131265

= Use Exclamation Mark (!) Notation for Precise Referencing =

Article ID: 131265

Article Last Modified on 2/15/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q131265



SUMMARY
Use the exclamation mark (!) notation to reference tables in databases (.DBC files). Use it to reference tables that have the same names but that exist in different databases, and use it to make code more readable. Its main purpose is to guarantee the opening of a specific table.



MORE INFORMATION
Here is the syntax: USE ! NOTE: Do not put spaces on either side of the exclamation mark.

Step-by-Step Example
  Create the following directory structure:   C:\MAIN C:\MAIN\ONE C:\MAIN\TWO This can be done Visual FoxPro by issuing these commands:   CD C:\ MD MAIN CD C:\MAIN MD ONE MD TWO   Issue the following commands in the Command Window: CD C:\MAIN\ONE CREATE TABLE tb_mytbl (fld1 c(10)) CD C:\MAIN\TWO CREATE TABLE tb_mytbl (fld1 c(10)) USE CD C:\MAIN CREATE DATABASE db_one ADD TABLE C:\MAIN\ONE\tb_mytbl CREATE DATABASE db_two ADD TABLE C:\MAIN\ONE\tb_mytbl SET DATABASE TO db_one These commands set up a scenario where a database named db_one contains a table named tb_mytbl, which is located in the C:\MAIN\ONE directory. Another database named db_two contains a different table named tb_mytbl, which is located in the C:\MAIN\TWO directory.

The issue is to open the tb_mytbl table in the db_two database. The current database is db_one, so you can't use this command: USE tb_mytbl It would open the table in db_one located in C:\MAIN\ONE.   Open the tb_mytbl table in the db_two database by using this command: USE db_two!tb_mytbl 

The exclamation mark (!) notation works in the same manner for long table names, and it makes code more readable. The notation makes it clear exactly which database holds the table of interest. It is especially useful in SQL-SELECT statements.

Additional query words: VFoxWin !-symbol bang symbol

Keywords: KB131265

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.