Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006

    Unanswered: if exists drop table?

    how can i check if a table exists and then drop it? using SQL?

  2. #2
    Join Date
    Feb 2004
    One Flump in One Place
    You can't do it all entirely in SQL. You need something (VB) to interpret the results.

    You can query Msysobjects for the table and then delete it if it exists (usual health warning that MS recommends you don't do this). Or you could poke around in the TableDefs DAO collection.

    To delete:
    DROP TABLE MyTableName
    EDIT - actually you could just set On Error Resume Next and execute the drop statement. No real need to check if it exists I suppose.
    pootle flump
    ur codings are working excelent.

Posting Permissions

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