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
 Procedure to automate Backup

Author  Topic 

neo151
Starting Member

1 Post

Posted - 2010-11-30 : 00:04:11
Hi plaese help me on this.
I need to write a sql procedure which run after a specific time and check a particular table in database.
if the entries are greater than a specified number. the procedure
itself create a new table which contain the all data of the same table and after creation of new table the old data in the current table should be deleted
.

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-11-30 : 02:20:34
Do you want this?



Create Procedure get_backup
as
Begin

if((Select count(1) from table_name)> 100)
Begin
insert into temp_table_name
Select * from table_name
Truncate table table_name
End

End

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page
   

- Advertisement -