Wednesday, March 7, 2012

copy a table and all its indexes, constraints, etc

How do I copy a table and all of its indexes, constraints, etc. I need to
do this in a routine where I fear possible errors and would like to restore
these tables and constraints if the process fails.
Tx for any help.
Bernie YaegerYou can script the table out and bcp out all its data. You then on an as
needed basis reapply the script and bcp the data back in.
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Bernie Yaeger" <berniey@.cherwellinc.com> wrote in message
news:POyrb.8933$si2.4437406@.news4.srv.hcvlny.cv.net...
> How do I copy a table and all of its indexes, constraints, etc. I need to
> do this in a routine where I fear possible errors and would like to
restore
> these tables and constraints if the process fails.
> Tx for any help.
> Bernie Yaeger
>|||Hi Allan,
Very good idea! Tx so much.
Bernie
"Allan Mitchell" <allan@.no-spam.sqldts.com> wrote in message
news:OZh4AQxpDHA.964@.TK2MSFTNGP10.phx.gbl...
> You can script the table out and bcp out all its data. You then on an as
> needed basis reapply the script and bcp the data back in.
>
> --
> Allan Mitchell (Microsoft SQL Server MVP)
> MCSE,MCDBA
> www.SQLDTS.com
> I support PASS - the definitive, global community
> for SQL Server professionals - http://www.sqlpass.org
>
> "Bernie Yaeger" <berniey@.cherwellinc.com> wrote in message
> news:POyrb.8933$si2.4437406@.news4.srv.hcvlny.cv.net...
> > How do I copy a table and all of its indexes, constraints, etc. I need
to
> > do this in a routine where I fear possible errors and would like to
> restore
> > these tables and constraints if the process fails.
> >
> > Tx for any help.
> >
> > Bernie Yaeger
> >
> >
>

No comments:

Post a Comment