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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL Stored Proc - copy table

Author  Topic 

ells
Starting Member

25 Posts

Posted - 2008-09-23 : 05:46:37
Is this possible and any suggestions?

I want to create a stored proc that will accept a table's name as a parameter. I then want the stored proc to create a new table called tablename_YYYY_MM_DD_HH_MM_SS.

I am currently having an issue with a process and I want to be able to record of copy of the table prior and post change. If I can create this then I can reuse for the next time I am developing.
Many thanks.
Ells

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-23 : 06:05:20
why do you want to do this way? what's purpose of creating a table for each date?
Go to Top of Page

ells
Starting Member

25 Posts

Posted - 2008-09-23 : 07:00:25
I am currently having an issue with a process and I want to be able to record of copy of the table prior and post change. If I can create this then I can reuse for the next time I am developing.

As an example Monday 9am I will be running a job to update the table 'fred'. This is a development job and I want to be able to observe all the results, therefore I need a copy of the table before, and after. Then at 9.30 when I find an error I will want to rerun the job after making a change. So I either go through this by hand everytime I need it or write some code.

Thanks.
Ells
Go to Top of Page

ells
Starting Member

25 Posts

Posted - 2008-09-23 : 07:09:30
Done it already.
Thanks.
Ells
Go to Top of Page
   

- Advertisement -