Copy Tables + Content + Structure From DB1 To DB2
Apr 16, 2007I need to make something that copies all tabels (structures + data) from a progress database into another mssql2000 database.
THANKS!
I need to make something that copies all tabels (structures + data) from a progress database into another mssql2000 database.
THANKS!
I have to copy a large (3000) amount of different tables from a Oracle machine into an
SQLServer machine.
I am able to do this using a (VB) script.
I use now several methods:
1) INSERT INTO TABLE1 SELECT * FROM SID1..DB.TABLE1 (SID1 is a linked server)
2) INSERT INTO TABLE1 SELECT * FROM OPENQUERY(SID1,'SELECT * FROM DB.TABLE1')
3) Also used OPENROWSET method (similar to 2)
For small tables this is fine, however for BIG tables (15M Rows/150Cols) the methods above are too slow.
If I compare the same copy action with a simple DTS, the DTS is 3 times faster.
Also, the DTS seems to bulk copy the data directly into the desired database while the
mentioned methods first fill the tempdb, then the transaction log of the desired database and
then finally the desired table (need very much extra space on your filesystem).
The total size of data is about 300GB.
Can anyone supply me with a simple example how to copy data from an Oracle table into a
SQLServer table in script (or SQL) that is as fast as the DTS and not filling my logfiles??
I read the bcp (which I use for import/export files) and bulk insert commands, but
I do not understand how to use them in this question.
Hi Guys,
What approach should I use to copy content of a text file. Is BCP capable of doing this? How about SSIS?
Example of the text file's content:
Date, "20060101"
ST_Code, "101"
A_Code, P_Code, T_Code, amount, price
"0001", "1111", "0101", 550, 230
"0002", "1111", "0102", 345, 122
"2001", 0212", 0930", 410, 90
In the example above, I just want to copy the rows Date, "20060101" and ST_Code, "101" into a table.
Regards,
Lars
for MS SQL 2000
table [Users] :
[id_Users] [int] NOT NULL ,
[Name] [varchar] (25) NOT NULL,
[Alias] [varchar] (25) NULL
how can I copy the content of [Name] into the column [Alias] only if [Alias] is Empty ?
thank you
Hi all,need advice on the following task:copy the content of a big table from DB_A to DB_B in the same serverthe size of table:~ 7 million rows, ~ 9G in size, 1 clustered pk index, 13 nonclusteredindexcurrent practice:use DTS to copy the data, takes over 20 hours as-- first had to delete existing data of the table in DB_B-- then copy-- all these happen while all indexes are in place.I am trying to check what is the best or most efficient way to copythis kind of data and what wouldbe the expected time for such load.my machine: SQL 2000 Enterprise, 8-way P4, 12G RAM on a EMC Clarrion600 SAN.
View 2 Replies View RelatedHi,
I'm using SQL Server 2005 Management Studio Express.
I have a database used for an application and I need another copy of that database so I can fix some bugs.
I tried attaching the mdf to the second database but it gives an error.(a database is allready attached)
I need the 2 databases on the same server.
Thanks,
Medeea
I have 1 table with some empty product codes that I have imported from a txt file. And I would like to fill in the empty product codes by taking the previous product code
date product_code
01/01/14 | BIC01 |
03/01/14 | |
01/01/14 | CASH |
04/01/14 | BIC01 |
02/01/14 | CASH |
05/01/14 | |
03/01/14 | CASH |
I though of using the LAG function but the table does not have any specific order.So after running the select, the table should look like:
date product_code
01/01/14 | BIC01 |
03/01/14 | BIC01 |
01/01/14 | CASH |
04/01/14 | BIC01 |
02/01/14 | CASH |
05/01/14 | CASH |
03/01/14 | CASH |
Hi Guys,
What approach should I use to copy content of a text file.
Example of the text file's content:
Date, "20060101"
ST_Code, "101"
A_Code, P_Code, T_Code, amount, price
"0001", "1111", "0101", 550, 230
"0002", "1111", "0102", 345, 122
"2001", 0212", 0930", 410, 90
In the example above, I just want to copy the rows Date, "20060101" and ST_Code, "101" into a table.
Regards,
Lars
how can I copy the content of the folder (including sub folders) from FTP location using ssis.
View 4 Replies View RelatedI just installed SQLEXPRESS on XP Prof. It is working fine. I want to know if there is a way to copy a table structure so I could create clones. I need about 300 tables with identical structure but different name for each one.
Also I am wondering if there is a way to ADD a table to SQL database. It is kind of a long shot but I will try to explain. I have about 200 tables in old Visual dBase format (v7.1). I would like to convert them to SQL Server tables. I found a company that offers an app that converts them to MySQL. I tried and it kind of works. I could open the output file in SQL Server but it is not a table but a kind of csv file with INSERT commands. I had to run it. So far it did not compile but in the future if those bugs (in their app) could be corrected I may end up with a single table which I may want to include in one of my databases. Is it possible?
Thanks.
Code Snippet
Hi there,
I'm struggeling for more than a week now with this problem, without a finding the solution.
I have two databases, MS Access and SQL Server 2005 Express Edition
Using a procedure in Visual Studio i would like to copy all the records from one table in MS Access into an existing table in SQL Server (the tables have the same name and the same layout)
I tried to prepare one Dataset to copy from Access into SQL Server but when i run the command 'DaSQL.Update(DsSQL, "Tabella") nothing happens (not even an exeption has been raised), looking during debug, the DataSet seems filled though...
Please could anyone explain what's wrong and / or is there a more quicker way to copy data from a table to another?
Note i woul have as a final goal to get data from an AS400 database by ODBC, manage it, and put it on SQL Server for a 'data mining' scope (eliminating the use of MS Access, not suited for FE-BE).
the procedure goes like this;
' Create a connection to the MS Access Database
Dim connectionToAccess As New OleDbConnection(DBConnectionAccString)
strsql = "SELECT * FROM [TABELLA]"
connectionToAccess.Open()
Dim DaAccess As New OleDbDataAdapter(strsql, connectionToAccess)
Dim DsAccess As New DataSet("ACCESS")
DaAccess.FillSchema(DsAccess, SchemaType.Source, "Tabella")
DaAccess.Fill(DsAccess, "Tabella")
' Create a connection to the SQL Database
Dim connectionToSQL As New SqlConnection(DBConnectionSQLString)
connectionToSQL.Open()
Dim DaSQL As New SqlDataAdapter(strsql, connectionToSQL)
Dim DsSQL As New DataSet("SQL")
DaSQL.FillSchema(DsSQL, SchemaType.Source, "Tabella")
DaSQL.Fill(DsAccess, "Tabella")
DaSQL.Update(DsSQL, "Tabella")
Note I tried also the following, withou a result;
DsSQL = DsAccess.Copy
DaSQL.Update(DsSQL, "Tabella")
Please is there someone who could respond !!???
Can anyone tell me;
Is there anyway to copy an entire database structure (layout of column definitions and character formatting)?
Or do I have to delete the relationship, then the child first?
For testing purposes, if I screw one up, I would like to be able to start with another copy.
Thanks
Hi all,
I want to copy a production database schema to an archiving database, only
the structure : tables, views, defaults, rules,UDTs. For achieving that
I am trying to use SQL/DMO functions, "CopyAllTables" for example. My script works with no error but unfortunately the destination database
contains no objects. Why, have I missed something ?
Does anyone know how to do that?
Many thanks for your help
Regards,
Herve
hmeftah@aol.com
hi
how can i copy a table structure from a database to another(without bakup)?
Hi,
In SQL Server, Is there any DDL available to copy a table structure alone and not the data,
I believe 'SELECT * into new_table from table1' will copy both structure and data as well.
Please advice,
Thanks,
MiraJ
We have SQL Enterprise Manager (8.0). Is there any way to Copy a Table from one database to another with only the Structure (design) - not all the Data?
I can't find any option in the Import Data Wizard that only copies the Table structure.
Any help is appreciated. Thanks
I have been working on my windows app, using SQL Server 2005 (& C#) but I now have loads of junk data, so I want to copy the structure without any data to a new set of files that can become the production version.
I assume I can use backup and restore in future when I want a copy of my production data to use for future testing.
How would I take just one table from my test database and add it to my production database without retyping the design?
Apart from the size limitation is there any advantage in buying a version of SQL Server over using the Express edition?
I'm looking to create a new version of a database but with completely reloaded data - so I want to retain the database structure but none of the data.
Is there an easy way (read: without a DBA on staff) to copy an existing database structure - preferably with views and stored procedures - and not take the data along for the ride?
Thanks in advance for suggestions...!
How does one generate Transact-SQL for table structure in SQL server express 2005?
I have very limited access to an SQL server database (using rudimentary web based interface) for my hosted website. I am ready to deploy an application that was developed with Visual Studio 2005 using SQL server express as the database. I have four tables that I want to copy (structure only) from "express" to the hosted SQL server. I think I need to generate Transact-SQL statements to "create" the table structure, then run these statements as a stored procedure on the web based SQL server. I'm having trouble trying to figure out how to generate the code from SQL express 2005. Anyone had any experience with this?
thanks.
Hello Room,
M stuck with an issue with SQL Query. My requirement is to create a temporary table with the out put of "SELECT" Clause..........
Like.......
SELECT NC_ID, AUD_PLAN_ID, AUD_CLAUSE_ID FROM AUD_NC
This is my "Select" Query and all I want is to store the out put in a #table. Now one way is to craete #tmp_table with the fields same as the out put column of the "SELECT" Clause......... But I want it in direct fashion.... dat means without Creating the #tmp_table directly...........
I tried with "CREATE TBALE #tmp_table AS SELECT NC_ID, AUD_PLAN_ID, AUD_CLAUSE_ID FROM AUD_NC".......... But it dini work
Please help me out in this regard......
Is there a way to copy the structure from one database to anotherwithout affecting the actual data?For example, I added new fields and stored procedures to a db in mydevelopment environment. There are a lot of them.I now want to make the same changes to my production environment db butdon't want to affect the data. Only the fields, stored procs &constraints and stuff pertaining to the structure of the db should bechanged.Does anyone know of a program that can do this or can this be done inMS SQL Enterprise Manager.Any help would be appreciated.7078895
View 2 Replies View RelatedHi,
Anyone plz do tell me what s the query to see the text content of stored procedure from system database tables..
from which table we get the content of sp
Thanks & Regards
ARV
Hi all,
How can I combine the contents of the two tables below? The combination result of these tables is provided below. Thanks
Table A
Client Weight Purchase
Tom 10 2
Bill 4 2
John 3 2
Table B
Client Weight Purchase
Jim 2 5
Lee 4 3
Bob 6 7
Combination table (result)
Client Weight Purchase
Tom 10 2
Bill 4 2
John 3 2
Jim 2 5
Lee 4 3
Bob 6 7
I'm a beginner with SQL 2012 SSDT & SSMS. I get this error message when I try to deploy my project:
"Error 6
Error (Data mining): KEY SEQUENCE columns are not supported at the case level. The 'Customer Key' column of the 'TK448 Ch09 Cube Clustering' mining structure contains content that is not valid.
0 0
"
I am finding it hard to locate the content that is not valid. I've been trying to find a answer for this problem but can't seem to find anything. How can I locate the content that is not valid and change or delete it so that I can deploy this solution?
I keep product name, id in Table1.
I keep Category name, id in Table2.
I keep relation between product and category (product_id, category_id) in Table3.
I have added some products to the table with proper category.
Work fine
But for some products I did not specified any category
(ie their id is not present in Table3)
But now I want all such products
(ie all products whose category is nothing)
To be associated with category_id 10
Can I do this simply with SQL queries?
Hope u can help me
sujith
Hi
Is there a way to select out the contents of sys.comments for an object (in this case, a procedure) so that it is nicely formatted?
The reason being, is that I want to update source control with all objects from the live environment (as it has become out of date.... long story). Currently, we have a single script for each object, split in directories for each object type. Anyway, I also want to wrap the objects in our standards (check for object existence, print out success/fail statements, etc).
Any suggestions to make the process more automated and less painfull? I don't want to have to script each object out, manually wrap it in standards and save as that would be perhaps the most tedious task in the world!!!!
Thanks!
Hearty head pats
HI,
Any help here is appreciated, I work in a large software company that has many small teams. I am faced with the issue of some of the other teams are changing the structure of tables and views and even SPs and functions without letting the rest know of these changes.
My question is, is there a way of tracking these changes through a job to alert everyone else in case this situation happens.
regards
I need to get the replacement records between the 2 tables. I have table A and table B with same structure. I have 5 fields. Table A has 50,000 records and table B has 20,000 records. I have fields id , name, address,meter_flag,end_Date.
Some of the records in Table B are just replacement records of table A. I mean for example I have records like this in Table A
id name address meter_flag end_date
23 john 1201 salt lake dr no 2011-12-28
24 tom 1222 gibson ln yes 2011-12-16
25 alex 1334 qayak dr no 2011-12-17
In Table B
23 john 1344 mc kinney st yes 2011-12-18
24 tom 1222 gibson ln yes 2011-12-16
56 gary 1335 pruitt rd no 2011-12-18
25 alex 1334 qayak dr no 2011-12-17
So here in Table B i have an update for john with id 23 in table A in address field and meter_flag has changed to yes. There is new record with id 25 in table b but that is not in table A. so I need to find all these difference records by querying these 2 table
I was wondering if there's a way to compare 1 table with other (in other DB), I mean:
Table1 DB1
ID
NAME
DESCRIPTION
Table1 DB2
ID
NAME
DESCRIPTION
ADDRESS.
And when the query(or other case) gets that the table 1 doesn't contain ADDRESS, alter the table and add this field that is missing.
Hi,
I have a complicated sql server mobile database (.sdf) and need to create a SQL SERVER database with the same tables. How can I do it without scripting the whole thing? I thought of using the views.information_schema databases, but it is still a lot of coding.
thanks
I’m trying to create a modified catalog tree out from two tables in sql
The catalog is created from two tables.
Table 1 has the lowest level and is showing the connection with the item and the lowest ItemGroup. It also shows the connection with the MainCatalog
MainCatalogId, ItemGroupId, ItemId
Example data:
(sorry for the tabs that won't work)
MainCatalogIdItemGroupIdItemId
715063823
715073824
715093825
715093826
The catalog structure is in table 2. Here are the connections between the different
ItemGroupId, ParentId
Example data:
ItemGroupIdParentId
15061365
15071365
15091364
13641066
13651066
1066NULL
To be able to use create the tree structure and not getting the result set to big, I need it to look something like this:
ItemGroupIdItemIdLevel 2 level 3Level4
1506 3823136510667
1507 3824136510667
1509 3825136410667
1509 3826136410667
I have tried many ways, but I’m not getting the result I want.
Hope this was understandable, and that someone has an idea if this is manageable
Thanks :)
I have created two table with same data structure. I need realtime effects (i.e. data) on both tables - Table1 & Table2.
Following Points to Consider.
1. Both tables are in the same database.
2. Table1 is using for data entry & I wants the same data in the Table2.
3. If any row insert, update & delete occers on Table1, the same effect should be done on Table2.
4. I need real time data insert, update & delete on Table2.
I knew that using triggers it could be possible, I have successfully created a trigger for inserting new rows (using logical table "Inserted") in Table2 but not succeed for update & delete yet.
I want to understand how can I impletement this successfully without any ambiguity.
I have attached data structure for tables. Thanx...
Hi
I want to delete the duplicate rows from two tables and get the resultant non-duplicate rows from both the tables into another table