Fast Copy Big Table Content

Jul 23, 2005

Hi all,

need advice on the following task:
copy the content of a big table from DB_A to DB_B in the same server

the size of table:
~ 7 million rows, ~ 9G in size, 1 clustered pk index, 13 nonclustered
index

current 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 copy
this kind of data and what would
be the expected time for such load.

my machine: SQL 2000 Enterprise, 8-way P4, 12G RAM on a EMC Clarrion
600 SAN.

View 2 Replies


ADVERTISEMENT

Copy Content Of A Text File Into Table

Nov 6, 2006

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

View 2 Replies View Related

How Can I Copy The Content Of MS Access Table In Database SQL Using Visual Studio Basic

Sep 26, 2007

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 !!???

View 6 Replies View Related

Copy Content Of Txt File

Nov 6, 2006

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

View 2 Replies View Related

Copy A Column Content In Another One Only If Empty

Dec 6, 2005

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

View 2 Replies View Related

Copy Tables + Content + Structure From DB1 To DB2

Apr 16, 2007

I need to make something that copies all tabels (structures + data) from a progress database into another mssql2000 database.

THANKS!

View 7 Replies View Related

How To Copy A Database's Content Into A New One On The Same Server?

Aug 29, 2007

Hi,
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

View 5 Replies View Related

Select - Copy Field Content From Previous Row?

Aug 12, 2014

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 |

View 5 Replies View Related

How To Copy The Content Of 3000 Oracle Tables Into SQLServer?

Nov 9, 2005

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.

View 14 Replies View Related

Integration Services :: Copy Folder Content / Subfolders From FTP Using SSIS?

Aug 20, 2015

how can I copy the content of the folder (including sub folders) from FTP location using ssis.

View 4 Replies View Related

Need A Fast Queue Using A Table

Jul 20, 2005

I am trying to implement a very fast queue using SQL Server.The queue table will contain tens of millions of records.The problem I have is the more records completed, the the slower itgets. I don't want to remove data from the queue because I use thesame table to store results. The queue handles concurrent requests.The status field will contain the following values:0 = Waiting1 = Started2 = FinishedAny help would be greatly appreciated.Here is a simplified script to demonstrate what has been done.CREATE TABLE [dbo].[Queue] ([ID] [int] IDENTITY (1, 1) NOT NULL ,[JobID] [int] NOT NULL ,[Status] [tinyint] NOT NULL) ON [PRIMARY]GOCREATE INDEX [Status] ON [dbo].[Queue]([Status]) ON [PRIMARY]GOCREATE PROCEDURE dbo.NextItem@JobID integer,@ID integer outputASSELECT TOP 1 @ID = [ID]FROM Queue WITH (READPAST, XLOCK)WHERE (Status = 0) AND (JobID = @JobID)RETURNGO

View 6 Replies View Related

Fast Loading Of Data To Table

Jul 10, 2007

Hi Every one,

How can I load or copy say millions of rows to a table in the database faster?

Thanks,
Mejo George

View 6 Replies View Related

Fast Export From #table To Remote Network Drive

Jan 30, 2008

Hi!
What is the fastest whay to take the resultset
from an temporary table (# table)
and write it to an remote destination (mapped network drive)
initiated from stored proc?

Similar question if I take the resultset and convert it to xml (using FOR XML clause)
and want it written to disk.

Thank you for your ideas ;-)

View 3 Replies View Related

Cannot Able To See The Content Of A Column In A Table?

Nov 12, 2001

hi everybody,

The problem is, I have a table with one column of varchar(8000) datatype. It has got 1000's of records. Through Query Analyzer, I am not able to view my records after 257 columns in my table, even I increased my textsize by using 'set textsize' command.

Any other setting is available to correct this. Any help is appreciated.

thanks,
Vasu

View 2 Replies View Related

Table Empty Of Content

Sep 10, 2001

I have a particular production database that on a few recent occasions has suddenly had one of it's tables empty of content. Now there are no jobs or triggers in place neither is any stored procedures that could perform a delete or alter table operation in place. The permissions have been set not to allow this either. The datatype is text only. What is intriguing is the QA server has an exact mirror and this dosen't happen. Has anyone come across this sort of phenomenon?

View 2 Replies View Related

How Do I Write Content In A Table To File

Mar 20, 2002

I know oracle uses UTL_FILE procedures lik putline, but microsoft?
Thank you for trying to help.

View 1 Replies View Related

Output Table Content To A Textfile (was Need Help On SQL!!!)

Nov 30, 2004

Hi.. anyone know wat the syntax to output the table content to a textfile? and copy back the content on the textfile back to the table?

Must use SQL command for MS SQL Server 2000 cannot use manual.. tks!

View 7 Replies View Related

Load XML Document Content In Table

Apr 8, 2008

I have a table having XML column. I want to read a XML document and insert content of the XML file into this xml column.
CREATE TABLE [XMLTest](
[DataAsXML] [xml] NULL,

[CreatedDate] [datetime] NULL
)

I have tried the following query
declare @filepath varchar(100)

declare @filename varchar(100)

set @filename = 'Referred'

set @filepath = 'D:ReportOutput'+ @FileName +'.xml'

print @filepath

insert into XMLTest

SELECT xCol,getdate()

FROM (SELECT * FROM OPENROWSET

(BULK @filepath,SINGLE_BLOB) AS xCol) AS R(xCol)



Problem is that When I give complete file path for BULK instead of variable name i.e. BULK 'C:Test.xml', query runs fine. But when I try to use @filepath, I get error "Incorrect syntax near '@filepath'." What am I doing incorrect? Also,If some one can suggest a better approach to load content of XML document to table?

Regards

View 2 Replies View Related

To Archive Content Of A Table Frequently

May 7, 2007

Hi,

In a project with SQL Servcer 2005 the customer is interested to save (archive) content of a table frequently. They want to have possibility to restore the table content as before. I have suggested to export the table every day to a text file and save the file in Visual source safe. If they need there will be possibility to import the text file later. Now I wonder, is there any other way to do archiving of the table content in SQL Server 2005?

Best regards

View 4 Replies View Related

Export Table Content To Sql Script

Aug 14, 2006

Is it possible in SQL express and SQL server mangement studio express to export table content to sql script, like form table

column1 column2
1 2 2
2 3 34
3 4 234

we get script

INSERT INTO [database].[dbo].[table] ([column1] ,[column2]) VALUES (2,2)

INSERT INTO [database].[dbo].[table] ([column1] ,[column2]) VALUES (3,34)

INSERT INTO [database].[dbo].[table] ([column1] ,[column2]) VALUES (4,234)

?

If it is not possible in express editions, is it at least available in developer editions?

View 1 Replies View Related

Adding New Content To A Table By Refering Other Tables Using SQL

Jan 5, 2007

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

View 4 Replies View Related

I Cannot View Table Content In MS SQL Server Express

Mar 19, 2007

I was able to view table content easily before, but after Ireinstalled everything, I cannot find the option to view table contentin MS SQL Server Express. I can define table with no problem. Checkout the screen snapshot below, from which you'll see that the popupmenu frrom right-clicking on the table name does not have the "Opentable" option. What is going on?http://farm1.static.flickr.com/167/...839620d0b_o.png

View 6 Replies View Related

Transact SQL :: How To Return Content Of Table As Columns In Query

Oct 1, 2015

I have

Customer table, tblCust: ID; Name

1 Peter2 Mary
Product table, tblProduct: ID; Name

1 Banana2 Orange3 Apple
Order tblOrder, tblOrder: CustID; ProductID; Amount

1 ;2 ;$20 – means Peter ordered $20 oranges

How do I write the SQL query so that the values in tblProduct become column, currently I have 20 items in that table. So, it will return something like this according to the information that I provide above?

Name Banana Orange Apple 

Peter 0 20 0

View 4 Replies View Related

Sql Server 2005 Express: Export/Import Content Of A Table

Apr 3, 2008

 I want to export data in a table from one database to another database. And I would like it bo be clone of the source table, if it's possible. Is there any tools out there that can help me with this or do I have to write my own code?Is it possible to query the database to get all columns and datatypes for å requested table? If possible, can you give me an example?If I have to write a tool myself I guess I would do something like this: Export - Query the database for columns and datatype for the requested table. Dynamically generate a query to retrieve all rows from the table and save it to an xml file. Import - Turn off the Identity Increment, loop through the xml file and generate insert queries to insert a clone of each row, turn off the Identity Increment. Viola! If programming only could be that simple :-) Regards, Sigurd 

View 5 Replies View Related

Reporting Services :: Table Of Content With Page Number In SSRS

Oct 30, 2015

How to creating a Table Of Content with page number in ( SSRS )SQL Server Reporting Services or when exported to pdf report.

FYI, Page number should be there in TOC.

Third party component is not accepted.

Dynamic Document Map will not work, as it cant get the page number.

I understand that there is no buildin feature which support this, but there should be some work around in SSRS or when export to PDF.

View 2 Replies View Related

View Field Content Update When Real Table Fields Change

Sep 1, 2005

Hi,I use view to join difference table together for some function. However,when the "real" table fields changed (e.g. add/delete/change field). Theview table still use the "old fields".Therefore everytimes when I change the real table, I also needed open theview table and save it by SQL enterprise manager manually for update theview table field.Can we use a SQL command or other method to update it directly?Regards,Silas

View 4 Replies View Related

Dbo.Table Of A Database In The .SQLEXPRESS Object Explorer: How To Copy The Dbo.Table To The Another Blank Dbo.Table?

Jan 9, 2008

Hi all,

The following dbo.Tables of Northwind.mdf in my .SQLEXPRESS (SQL Server Management Studio Express) are missing:
dbo.Categories
dbo.CustomerCustomerDemo
dbo.CustomerDemographics
dbo.Customers
dbo.Employees
dbo.EmployeeTerritories
dbo.Order Details
dbo.Orders
dbo.Products
dbo.Regions
dbo.Shippers
dbo.Suppliers
dbo.Territories.

But, I have these dbo.Tables in a different Database "xyzDatabase". How can I copy each of these dbo.Tables to the another blank dbo.Table of Northwind Database?

I right clicked on the dbo.Categories and I saw the following thing:
dbo.Categories
New Table...
Modify
Open Table
Script Table as |> CREATYE To |>
DROP To |>
SELECT To |>
INSERT To |> New Query Editor Window
File....
Clipboard
UPDATE To |>
DELETE to |>
From the above observation,I think it is possible to copy the dbo.Table from the one Database to the Northwind Database that needs to be repaired. Please help and advise me how to do this task or tell me where I can find the Microsoft document that gives the details of this X-copy thing.

Thanks in advance,
Scott Chang

P. S. I am using VB 2005 Express to create a project to learn "Calling Stored Procedures with ADO.NET" (see Paul Kimmel's article in http://www.developer.com/db/article.php/3438221) that needs the dbo.Tables of Northwind Database and my Northwind Database has been screwed up for quite a while and needs a big repair.

View 3 Replies View Related

Stored Procedure To Copy Table 1 To Table 2 Appending The Data To Table 2.

Jan 26, 2006

Just wondering if there is an easy transact statement to copy table 1 to table 2, appending the data in table 2.with SQL2000, thanks.

View 2 Replies View Related

Help On Updating A Field In A Table With The Field Content Of Another Table

Jun 25, 2007

HI everybody need help on this..

I have two tables below

table1

country countryid

africa ___
usa ___
italy ___
Spain ___

table2

countryid country name

1 africa
2 germany
3 italy
4 usa


I need to write the countryid of table 2 to the field countryid in table1 using the criteria of the correspoinding country name table 2 to country of table 1 if it write countryid else 0..

THE RESULT WOULD BE

country countryid

africa 1
usa 4
italy 3
spain 0

thanks

View 7 Replies View Related

How To Copy A Column(or Colums) From A Table In One Database To Another Table In A Different Databas

Oct 1, 2001

How do I copy a column(or colums) from a table in one database to another table in a different database

View 1 Replies View Related

Copy Rows To The Same Table And Its Related Data In The Other Table

Nov 23, 2007

Hi All,
I have 2 tables People & PeopleCosts.

PeopleID in People Table is the primarykey and foreign Key in PeopleCosts Table. PeopleID is an autonumber

The major fields in People Table are PeopleID | MajorVersion | SubVersion. I want to create a new copy of data for existing subversion (say from sub version 1 to 2) in the same table. when the new data is copied my PeopleID is getting incremented and how to copy the related data in the other table (PeopleCosts Table) with the new set of PeopleIDs..

Kindly help. thanks in advance.
Myl

View 3 Replies View Related

Copy Records From One Table To Another Table With Same Structure

Jan 20, 2007

Hi allI have two tables in SqlServer with Exactly Same Structure,I want to Copy all Records fromone of them to another one.I came across to "Insert....select..." statement But i have two problem
1) I don't know any thing about Columns name!!! i just know they have same structure and as far as i know , "Insert...select..." need the Column list to operate correctly, am i right?
2) these two table have One Prinary Key column with IDENTITY feature.
Any Help Greatly appriciated.Regards.

View 6 Replies View Related

How Do I Copy / Insert A Primary Key Value Of One Table Into Another Table?

Dec 10, 2007

 

Hi i have set up  two very simple tables, I want a user to be able to create a basic account ( data stored in User_Profile  table with Id set as the Primery Key as Identity) I
want the user to be able to be able to return to their account at a later date
and then post multiple reviews of different bands they have seen at a later date.
I kept the tables in my example very simple so I could get my head
around the concept, but generally, I want to connect the Id (PK) value in
User_Profile table to the User_Id filed in the User_Review table,
so every review that user writes, will be connected directly to their Id.  

Any help you could give would be fantastic a i have no idea where to start!!!

  

User_Profile

Id   int,  ( as primary Identity Key)

Name

City

Country

 

I have a second table called User Reviews

 User_Revews

Revew_Id   int ,  ( as primary Identity Key)

User_Id  int, ( I want this to contain the Id value in
the User profile Table)

Review_Details

 

 

Thanks

 

Odxsigma

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved