Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alias name already in use??

Status
Not open for further replies.

gregory100

Programmer
Jun 10, 2004
2
DO
Hi, How could avoid the error:Alias name already in use, in a SQL

thanks
 
If you are using a SQL SELECT statement and storing the results to a cursor, you may be giving the cursor the same name as one of the tables in your data-environment. For example, if I had a table called "MyTable" in my data-environment and tried to execute this code:

SELECT * FROM MyData INTO CURSOR MyTable

I would get your error.

The cursor name must be unique to the data environment.

-Kevin
 
You could always test for the ALIAS before attempting to use it.

* --- Ensure Alias Not Already In Use ---
IF USED('ThisAlias')
SELECT ThisAlias
USE
ENDIF

Good Luck,
JRB-Bldr
 
Also, if you run 2 SQL selects in a row on the same tables, the first one may have left table(s) open that the second select statement stumbles on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top