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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating and naming TABLE using SYS(2015)

Status
Not open for further replies.

mensud

Programmer
Jul 22, 2001
51
0
0
US
Hi,
I am trying to copy records from cursor into a table, whose name is created using SYS(2015) function. The code looks like:

tmptable=substr(sys(2015),1,10)
select * from cunion into table c:\&tmptable

use c:\&tmptable in 0
select (tmptable)

Every time when compiler try to execute the line: select(tmptable), I am getting the error: "Alias '8F0LFEAH' is not found'. I revrited the code a few times, but I could not select the table.
My question is how to open the table created like this.

Thanks a lot.
Mensud

 
Hi Mensud,

When I run your code I get a "File in use" error on the statement: use c:\&tmptable in 0

In any case your file tmptable is already USEd and SELECTed as a result of your statement:
select * from cunion into table c:\&tmptable

I'd suggest you just omit the last 2 statements.

Jim


 
You might be better off with the following:

tmptable = "C:\" + substr(sys(2015),1,10)
select * from cunion into table &tmptable

Then:
USE (tmptable) IN 0 ALIAS MyTable
SELECT MyTable
OR
USE (tmptable)
mcAlias = ALIAS()
SELECT (mcAlias)

Good Luck,
JRB-Bldr


 
HI

tmptable=substr(sys(2015),1,10)
select * from cunion into table c:\&tmptable

tmpAlias = ALIAS()

SELECT (tmpALias) will help you select the alias whereever needed. Since the table or cursor is already open, you need to close it before opening or open with the AGAIN statement. If you only need an alias name for later reference, then SELECT (tmpALias) will do it for you. HOwever, make sure that the tmpAlias variable is available at places where you need it. If you are in doubt.. then..

tmptable= "C:\"+substr(sys(2015),1,10)
select * from cunion into table (tmptable)
USE
USE (tmpTable) IN 0 ALIAS myTable
SELECT myTable
..
..
NOte that the path is added in the variable for proper path reference.

:)



____________________________________________
ramani - (Subramanian.G) :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top