PDA

View Full Version : SQL syntax



KJSutsa
07-24-01, 04:24 PM
i want to create a table from a query of an access db in a vb6 application using sql. what is the proper syntax to do this.
i can get it to delete files in the table by using:
DB.Execute ("DELETE FROM RarTable WHERE [File Type]= 'APPLICATION'")

To create a new table from a query I tried using:
db.execute ("CREATE TABLE TABLE_NAME AS SELECT * FROM TABLE_NAME2 WHERE [File Name] = 'APPLICATION'")
but i keep getting a syntax error.
What is the right syntax....?????
please help!!

Stu
07-25-01, 09:01 PM
I haven't done this in Access in ages, but you need to use the SELECT ... INTO query (it's similar to the Transact-SQL version).

Example:




SELECT FROM t.*
INTO TABLE_NAME
FROM TABLE_NAME2 AS t
WHERE [File Name] = 'APPLICATION'