Hello all
I want to make a copy of a table in SQL Server 2005, a back-up of my table
if you will. I don't see any way of doing this, I am I right in assuming
that one can't copy a table in an SQL Sever 2005 database?
ie: MyTable -> MyTableCOPY = 2 Tables in the same database
Thank you for your time.
Regards
David
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
"David" <someone@.someisp.com> wrote in message
news:op.t4y5ugvcrasovn@.pavilion...
> I want to make a copy of a table in SQL Server 2005, a back-up of my table
> if you will. I don't see any way of doing this, I am I right in assuming
> that one can't copy a table in an SQL Sever 2005 database?
Just use
select * into newtable from oldtable
|||David
You can script out (with the data) the table and save it on the disk.
"David" <someone@.someisp.com> wrote in message
news:op.t4y5ugvcrasovn@.pavilion...
Hello all
I want to make a copy of a table in SQL Server 2005, a back-up of my table
if you will. I don't see any way of doing this, I am I right in assuming
that one can't copy a table in an SQL Sever 2005 database?
ie: MyTable -> MyTableCOPY = 2 Tables in the same database
Thank you for your time.
Regards
David
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|||Leon
If the database got corrupted you are still not be able to get back the
table. I think the way to save the datai is having proper backup of the
database or if the database is big, just script out into the text file the
table and keep it on the disk.
"Leon Mayne" <leon@.rmv_me.mvps.org> wrote in message
news:ubieII4VIHA.1164@.TK2MSFTNGP02.phx.gbl...
> "David" <someone@.someisp.com> wrote in message
> news:op.t4y5ugvcrasovn@.pavilion...
> Just use
> select * into newtable from oldtable
|||"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:u3D5IM4VIHA.4532@.TK2MSFTNGP02.phx.gbl...
> Leon
> If the database got corrupted you are still not be able to get back the
> table. I think the way to save the datai is having proper backup of the
> database or if the database is big, just script out into the text file
> the table and keep it on the disk.
Read the original post. They arn't talking about proper backups, they just
want a copy of the table in the same database.
|||Leon
The OP does not say that he wants the copy in the same db. He just said that
both tables are located in the same db
"Leon Mayne" <leon@.rmv_me.mvps.org> wrote in message
news:22CAA140-7D18-44BE-A9C4-A997937E5CF3@.microsoft.com...
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:u3D5IM4VIHA.4532@.TK2MSFTNGP02.phx.gbl...
> Read the original post. They arn't talking about proper backups, they just
> want a copy of the table in the same database.
|||"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23OsMlY4VIHA.2268@.TK2MSFTNGP02.phx.gbl...
> Leon
> The OP does not say that he wants the copy in the same db. He just said
> that both tables are located in the same db
"ie: MyTable -> MyTableCOPY = 2 Tables in the same database"
But you could be right. Whatever.
|||Hi David and Leon
This simple SELECT INTO will copy the table structure and all the data to a
new table.
It will not copy indexes, constraints, or triggers.
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Leon Mayne" <leon@.rmv_me.mvps.org> wrote in message
news:ubieII4VIHA.1164@.TK2MSFTNGP02.phx.gbl...
> "David" <someone@.someisp.com> wrote in message
> news:op.t4y5ugvcrasovn@.pavilion...
> Just use
> select * into newtable from oldtable
|||"Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
news:u1DrLC5VIHA.1208@.TK2MSFTNGP05.phx.gbl...
> Hi David and Leon
> This simple SELECT INTO will copy the table structure and all the data to
> a new table.
> It will not copy indexes, constraints, or triggers.
Correct. These schema objects would have to be copied manually, but if you
just want a quick backup copy of a table to play around with the data then
select into works well enough.
|||I agree, the data is the most important thing and the indexes, etc can
always be recreated. The OP should make note of what triggers, indexes and
constraints there were so that he will know to recreate them if he has to
revert to the copied table because it get accidentally dropped. (Of course,
it's all hypothetical, right, really nobody accidentally drops a table.
;-) )
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Leon Mayne" <leon@.rmv_me.mvps.org> wrote in message
news:C3367EE5-E728-46E5-8C83-3782ADF0141C@.microsoft.com...
> "Kalen Delaney" <replies@.public_newsgroups.com> wrote in message
> news:u1DrLC5VIHA.1208@.TK2MSFTNGP05.phx.gbl...
> Correct. These schema objects would have to be copied manually, but if you
> just want a quick backup copy of a table to play around with the data then
> select into works well enough.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment