Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Table Deleting - Starting begining of a month
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

wsilage
Yak Posting Veteran

USA
82 Posts

Posted - 04/16/2013 :  11:30:16  Show Profile  Reply with Quote
Hi,

I know how to drop and create a table, but I was wondering if there was a way to drop a table and recreate the table when it hits the beginning of each month. If so, how would I write that in my store Procedure?

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 04/16/2013 :  11:36:35  Show Profile  Reply with Quote
yep...you'll write it in same was as DROP and CREATE

only difference is you'll create a sql server agent job and call the store procedure from it

Then schedule the job to be executed monthly by giving a suitable date.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

wsilage
Yak Posting Veteran

USA
82 Posts

Posted - 04/16/2013 :  11:44:16  Show Profile  Reply with Quote
oh okay, thanks!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 04/16/2013 :  11:53:30  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 04/16/2013 :  12:26:34  Show Profile  Visit russell's Homepage  Reply with Quote
Why? Just to clear it out? Use TRUNCATE TABLE <table name> for that.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.1 seconds. Powered By: Snitz Forums 2000