Feedback:

Add IF EXISTS syntax to DROP TABLE, ie. DROP TABLE IF EXISTS #list to "stop" exceptions

This would be so useful (and I think) easy to implement...

12 votes
Vote 0 votes Vote Vote
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service

    You'll receive a confirmation email with a link to create a password (optional).

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    anonymousanonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    4 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service

      You'll receive a confirmation email with a link to create a password (optional).

      Signed in as (Sign out)
      Submitting...
      • Edgar ShermanAdminEdgar Sherman (Admin, advantage) commented  ·   ·  Flag as inappropriate

        @AzzaAzza69
        It works on free tables. Two gotchas with sp_gettables. 1) The tableNamePattern is case sensitive. 2) don't add the # when looking for temp tables (see KB Item 091124-2232 for a more complete explanation)

      • AzzaAzza69AzzaAzza69 commented  ·   ·  Flag as inappropriate

        Neither of the above methods (sp_GetTables or SELECT...from system.tables) work for the non-data dictionary connection method!

      • synacksynack commented  ·   ·  Flag as inappropriate

        if exists (select name from system.tables where name ='test') then
        drop table test;
        end if;

      Knowledge Base and Helpdesk