Friday, February 24, 2012

Coping table from one database to another

I have databases HR and HR2
how copy table PERSONS from database HR to HR2?
Thanks a lot!CREATE TABLE HR2.dbo.Persons (...) /* If it doesn't already exist */
INSERT INTO HR2.dbo.Persons (...)
SELECT ...
FROM HR.dbo.Persons
David Portas
SQL Server MVP
--|||Select * into HR2.DBO.PERSONS
From HR.DBO.PERSONS
Best Regards,
Luqman
"Valery Frolov" <f1414@.mail.ru> wrote in message
news:tkl601lo9vobjqla2sufedhnknjiletf4a@.
4ax.com...
> I have databases HR and HR2
> how copy table PERSONS from database HR to HR2?
> Thanks a lot!
>|||Note that SELECT INTO copies the data but not the constraints. SELECT
INTO can be very handy in development but in a production system you
will usually want to separate DDL and DML operations.
David Portas
SQL Server MVP
--|||you can also use Data Transformation Services (DTS) to do this Look this up
in Books On Line.
Greg Jackson
PDX, Oregon

No comments:

Post a Comment