title: How to use commands like DROP TABLE etc. within a stored procedure
body: <p>I have written a script which is intended to be scheduled to run overnight to copy yesterday's tables, drop yesterday's tables, create new tables, then compare changes. This is working fine as a scheduled task, but I am really struggling to find a way of allowing the users to execute it on the fly for testing purposes.</p>
  
  <p>What I really want to do is to pack it all into a stored procedure, as I have an eForm tool which will easily allow the user (very non-technical) to be able to execute the procedure with a click.</p>
  
  <p>Here is an example of the start of the script. Can anyone help me shoehorn this into a stored procedure as it clearly won't accept commands like DROP TABLE as standard.</p>
  
  <p>Thanks.</p>
  
  <pre><code>DROP TABLE SQL2005TEST.ABSENCEFULLDATADIFF_YESTERDAY;
  DROP TABLE SQL2005TEST.ABSENCELATESTSTART_YESTERDAY;
  DROP TABLE SQL2005TEST.ABSENCELATESTEND_YESTERDAY;
  
  CREATE TABLE SQL2005TEST.ABSENCEFULLDATADIFF_YESTERDAY
   AS SELECT * FROM SQL2005TEST.ABSENCEFULLDATADIFF;
  
  CREATE TABLE SQL2005TEST.ABSENCELATESTSTART_YESTERDAY
   AS SELECT * FROM SQL2005TEST.ABSENCELATESTSTART;
  
  CREATE TABLE SQL2005TEST.ABSENCELATESTEND_YESTERDAY
   AS SELECT * FROM SQL2005TEST.ABSENCELATESTEND;
  </code></pre>