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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-05-13 : 08:17:57
|
| gurvinder writes "HII want to create a stored procedure in sql server.I have 2 tables called orders and orderdetails which contains list of orders.Now i want to move orders which r more than 60 days old to new table called orders2 and orderdetail2. and wants to delete those orders from first tables thats orders and orderdetails.please can anybody make it fast for methank yougary" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-05-13 : 08:44:21
|
| Create Procedure MoveData asInsert into orders2 select * from orders where datediff(day,orderdate,getdate())>60GoInsert into orderdetails2 select * from orderdetailss where datediff(day,orderdate,getdate())>60GoDelete from orders where (day,orderdate,getdate())>60GoDelete from orderdetails where (day,orderdate,getdate())>60MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|