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 |
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2011-06-18 : 15:02:24
|
I have 18 monthly tables(Jan 2010 to June 2011) and every month i need to delete the old table(Jan 2010) and need to create a new table July 2011. I think this should be done using dynamic query...can someone shed some light for me on this? I am unable to think about how to write a script which drops the old table and creates a new table.(Everything should be with in one transaction)Thanks in Advance. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
|
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2011-06-18 : 17:17:28
|
Thanks Tara. But One table does not solve the solution because each time when we delete the data, i may need to drop the field group and create one(The table structure is in that way). The easiest way is to drop the old table and create a new table with in the transaction.Also even table partitioning needs similar kind of query where i may need to drop the old data(Field group) and need to insert data in the new Field group.I am having hard time to build a dynamic query which does all the operation with in a single transaction. Need some help in here. |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|