Results 1 to 2 of 2

Thread: SQL syntax

  1. #1
    KJSutsa
    Guest

    SQL syntax

    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!!

  2. #2
    Regular Member
    Join Date
    Aug 1999
    Posts
    341
    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:

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •