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 |
|
raymondpeacock
Constraint Violating Yak Guru
367 Posts |
Posted - 2003-11-18 : 08:17:47
|
| Is there a T-SQL way of creating an exact copy of a SQL Server Object?What I'm after is a way of, for example, creating a copy of a t_order table called t_order_backup with data (I can obviously get that using SELECT INTO), triggers, indexes and permissions?Something similar for stored proc and views would also be nice!Thanks in advanceRaymond |
|
|
skillile
Posting Yak Master
208 Posts |
Posted - 2003-11-18 : 09:08:47
|
| How about a backup?DTS will do this for you or you could use EM and generate the scripts of your tables.Select INTO...slow down to move faster... |
 |
|
|
raymondpeacock
Constraint Violating Yak Guru
367 Posts |
Posted - 2003-11-18 : 09:11:07
|
| Yeah thanks skillile, but I knew about those. The backup won't allow me to restore to different object names, similar for DTS and EM Generating the scripts.Ideally I'm after something like the sp_rename procedure, but which leaves the original object intact.Raymond |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-11-18 : 11:04:06
|
| Why don't you script the objects?Brett8-) |
 |
|
|
raymondpeacock
Constraint Violating Yak Guru
367 Posts |
Posted - 2003-11-18 : 11:07:55
|
| Hi BrettYeah, I think that's what I'm going to have to do (although scripting is DDL isn't it, and therefore won't generate a copy of the data). Also, in the script generated I'll need to do a Find/Replace before running it to create named copies of the original objects (which will be a pain!).ThanksRaymond |
 |
|
|
|
|
|