How to copy a table (with the data) from one server to another (the two servers are in different PCs)? Basically if I could move the data to a txt file inthe form of the insert command (like the import/export of phpmyadmin) all would be ok
16 22978
Do you want to transfer the table in SQL Server A to SQL Server B as a table? Or you want to export the content of a table from SQL Server A to another PC?
-- CK
Tables from SQL sever A to SQL server B which is in different host (those two are not related in any way) (For the table sructure I script the table as "Create into" take the query and run it in the other SQL -with the appropriate modifications -is anything similar for the table data?)
You can use your management studio and use the Import wizard or connect to the other SQL server through linked server and do a SELECT * INTO...
-- CK
you can use the sql import export wizard for copying the table structure with data.but am not sure if u are copying more than table,the relationship will exists in the new table or not.
choose destination database -->right click-->tasks-->import Data-->choose source databse ,then following the wizard choose the source table,ok?
A little different problem, how can you copy a table (with its data) from one database to another when BOTH DATABASES ARE ON THE SAME SQL server? Tried the - SELECT * INTO NewTable FROM existingdb.dbo.existingtable;
but then when I checked the resulting generated scripts from the 2 tables saw that the declaration of a column as primary key was gone () any suggestions?
Kindly make a separate post for this one so that others can view and learn from this.
Thanks,
-- CK
Didn't get it, make a different post you mean start a new thread? For this case I guess the title of this post includes this question also. In any case here are a bit more details, I have a databese with some tables which get regulary updated I want these tables to be able to 'copy' them in a 'backup' database make some other arrangments to the original database and then 'post' them back. As mention above the 'SELECT INTO' command makes all my primary keys disappear, so for the tables structure I will take the create scripts generated by SQL for the tables I want and then I will populate them with an 'insert' into my problem is that before all that I want to be able to check if a table exists in the backup database and if it does to make a 'drop' so the following 'create table' command would not cause an error saw somewhere something like 'if exists' but couldn't make it to work. Again any ideas would be helpful
SELECT INTO creates a new table. Since it's a new table, all relationship, constraints, etc will not be automatically created. This looks like a production data. What you could do is to backup the entire database twice. One is your actual backup that you can keep/archive. The other is for you to do your "other arrangements". You have to put your production database offline first so no one can change it. After you're done with your "arrangements" drop your production database and use your "arranged" database as your new production.
To check if the table is existing, try this function.
Good luck.
-- CK
The problem is that from the one databese I want 1 table (say 2 columns one primary key with autoincrement) to copy it with its data to another database tried the "insert into DB.table1 select * from DB.table2" but throws error when trying to write in the primary key column also tried the export wizard still the same. Any ideas?
@ck9663
Dear can you tell me, i have a problem when i export any database from server a to server b then tables are export but there primary key and Auttoincrement and bind valuse not moved. you have to again set it
tell me what to i do to export table with these valuse.
regards
vikas
Personally I wanted to move 15 tables form database A to B in SQL 2008 so I used the "insert to" command and then for all restriction (primary keys, etc) which are in seperate folder on the right tree-view panel. right-click script as->add restriction (or something like that) and the SQL will automatically generate the code for each restriction, executed that code in the new database and vouala! you're done
i am using sql 2005. in this i open data base A then onthe table i right click and then chosse script-->create to-->new query editer
then i database B then i open his New query editer and past that script but it show error near '(' but i dont thing so there is some erro
tell me what to i do.
Try the import/export wizard, this will get you the data for sure if the restrictions re not copied you will have to do it manually with each table as said above,
to copy table/data use -
SELECT * INTO test.dbo.Table_1 FROM source.dbo.Table_1;
-
and for the restriction the SQL will produce something like -
ALTER TABLE test.dbo.Table_1 ADD CONSTRAINT PK_Table_1 PRIMARY KEY (id)
To copy data from one table to another where the tables are located in different databases (regardless of their type or location), you can use a tool called Data Moving Tool. It does exactly what you need.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Kenneth Osenbroch |
last post by:
Hi. I want to create a trigger that only allows delete from table A if
corresponding record in table B does not exist. Any idea on how this
can be done? Thanks, Kenneth.
|
by: Raj |
last post by:
Hi,
I am trying to add some more information to the table which already
has a lot a data (like 2-3000 records). The new information may be
adding 2-3 new columns worth. Now my questions are:...
|
by: Mo |
last post by:
Hi,
I have two datasets on two databases one remote and one local. I am
trying to copy the local data into the remote. Both tables have the
same structure. I use the following
DataTable...
|
by: Bill |
last post by:
Hi All, New to the whole .Net and C# thing but trying.
In classic asp this was simple to fill a table with dynamic content and
hyperlinks.
Here is an example of what I am trying to do in classic...
|
by: Tomek |
last post by:
Hi,
I'm new in C# programming. I received an order to create application
with ODBC technology. Application seems to be simple, It should copy
table from database, for example SQL server, to...
|
by: BeckR |
last post by:
Hello - Thanks for reading my post.
I am a newbie when it comes to VBA programming, but have managed to do what I need to do, until now.
I have an Access 2000 database (running WinXP Pro...
|
by: JimDavie |
last post by:
Okay guys,
I'm struggling with understanding how to properly update a table with values from a temp table I created from an APPEND query which provides totals information off of an applicaion...
|
by: toofunny24 |
last post by:
I have two tables and both have identical fields for the most part. Both tables are linked by product id. One table is used for entering actual data. Table two contains the specs/target numbers...
|
by: jerome london |
last post by:
I am working on a project for a class and would like to know if or how to get my data base to auto up date a table with informatiion from another table. Oh I am working with Visual Studio 2010, Any...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |