Monday, March 19, 2012

How to recreate a table and copy its data too?

I have different versions of essentially the same database on two different computers. From Computer B I need to copy one table AND its data to Computer A.

I've read several articles and have tried several things but can't figure out how to do it. Incidentally, I'm running SQL Server Express 2005 on both machines.

Robert Werner
Vancouver, BC

Import \ Export Wizard is the best way to recreate tables to another server with the same structure and data.|||But this does not exist in SQL Server 2005 Express does it?

Robert
|||

How about linked servers?


Or:

Code Snippet

SELECT *

INTO YourTable

FROM OPENROWSET('SQLNCLI', 'Server=SQLServer\SQLEXPRESS;Trusted_Connection=yes;',

'SELECT col1, col2, col3 FROM YourDB.dbo.YourTable') AS a;

Remember you'll need to enable Ad Hoc Queries in Surface Area Configuration.

HTH!

No comments:

Post a Comment