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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Table Deleting - Starting begining of a month

Author  Topic 

wsilage
Yak Posting Veteran

82 Posts

Posted - 2013-04-16 : 11:30:16
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

52326 Posts

Posted - 2013-04-16 : 11:36:35
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

82 Posts

Posted - 2013-04-16 : 11:44:16
oh okay, thanks!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-16 : 11:53:30
welcome

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

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2013-04-16 : 12:26:34
Why? Just to clear it out? Use TRUNCATE TABLE <table name> for that.
Go to Top of Page
   

- Advertisement -