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!

Undeclared variable error 1

Status
Not open for further replies.

penguinspeaks

Technical User
Nov 13, 2002
234
0
16
US
Hello. I am hoping is a simple answer to this because I have not come across it before.
I have run similar code many times but now getting an error.
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[MySQL][ODBC 3.51 Driver][mysqld-5.6.33-log]Undeclared variable: BRACKET16_73

/start1.asp, line 51

Code:
SQL = "SELECT * INTO BRACKET16_"&IDT&" FROM BRACKET16_TEMP"
CONN.EXECUTE(SQL)

When I run response.write it displays perfectly.

Code:
SELECT * INTO BRACKET16_73 FROM BRACKET16_TEMP

Please help me understand what variable could be undeclared or why I am seeing this error.


Thanks,
Penguin
 
Well, MySQL is telling what it doesn't interpret as a table name: BRACKET16_73

If you want to create a new table look at this:
or more direct in the MySQL reference:

In short, the syntax in MySQL is
Code:
CREATE TABLE BRACKET16_73 AS SELECT * FROM BRACKET16_TEMP;

Bye, Olaf.

Olaf Doschke Software Engineering
 
I was under the impression that a select into created the table.
Is this not correct??

Thanks,
Penguin
 
I did use your suggestion and it now works perfectly.
Thanks for the help and reply.

Thanks,
Penguin
 
Well, SQL isn't SQL and within MySQL just look at the reference about SELECT INTO:

The target is never a new table, it's a variable list, a file (TXT/CSV) or a dumpfile, but not a new table.

And if you have an existing table the command also is vice versa, the overall is an INSERT INTO then, and the SELECT as the source of data still comes afterwards:
Code:
INSERT INTO BRACKET16_73 SELECT * FROM BRACKET16_TEMP;

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top