DROP WORKSHEET

  • I have an Excel connection, and a SQL Task.  The SQL Task is connected to the Excel connection.  The spreadsheet contains 3 worksheets.  I'm trying to programmatically delete Sheet1.  In another thread, I saw that the following code should work:

    DROP TABLE 'Sheet1'

    GO

    However, it does not work.  I get an error message saying the table doesn't exist.

    I've tried it with single quotes around the table name.  I've tried it with square brackets around the table name.  I've tried it with a dollar sign at the beginning of the table name.  I've tried it with a dollar sign at the end of the table name.  Nothing seems to work.

    Any help would be greatly appreciated.

    Thanks.

     

  • After playing with it further, I discovered that, although I still can't get it to work, the code will execute error-free if I enclose everything in that weird little single quote character - the one directly above the Tab key on a normal keyboard.  For example, 'Sheet1'

    Ditto if I do [Sheet1$]

    Despite this, it's still not doing what it is supposed to do.  It does not remove the worksheet.

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply