Copying Data From Another DB On Server Problem
Mar 2, 2005
What iam trying to do is put the table name from one db into a variable and another one into another variable and pass them into my statement basicaly trying to bulk copy data from one table in a db and insert it into another db on the same server based on a condition
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ClientComment]')
and OBJECTPROPERTY(id, N'IsUserTable') = 1)
Declare @BDFR varchar(20), @BDTO varchar(20), @EQID varchar(20)
set @BDFR = 'Commander' + '.dbo.' + 'ClientComment'
set @BDTO = 'Test_Commander' + '.dbo.' + 'ClientComment'
set @EQID = '80_300_005'
insert into @BDTO
select * from @BDFR where Eqid = @EQID
View 2 Replies
ADVERTISEMENT
Oct 16, 2006
Hello I am developing a web application that will allow users to upload a .mdb file and from that file I need to populate an SQL database. I know the table name of the .mdb file, but I am unclear how to structure my data access layer correctly. How do I pull data from the .mdb file and once I have it how do i populate the SQL database?Any advice would be greatly appreciated.thanks!
View 1 Replies
View Related
Oct 24, 2005
I'm having an issue with a job that calls a stored procedure. The SP is fairly complicated, but basically creates a temp table, then inserts the records from the temp table into a table on a linked server (via VPN). The basic premise here is that I'm trying to update a web-accessible server from the production server. The funny thing is that the process works correctly for 4 out of 5 companies (company is the only parameter fed to the SP). The company that fails is by far the largest, but the process has worked in the past.
I'm not strong with all the tools available in SQL Server that might help me figure out what's going wrong. In the SQL Server Agent, it simply tells me that the job failed. If I use Query Analyzer and run the SP in Debug mode (if I'm stating that correctly), I get this error for any company I try it for, even companies that run fine (line 51 is the DELETE line):
Server: Msg 7391, Level 16, State 1, Procedure procStmtDataToReno, Line 51
[Microsoft][ODBC SQL Server Driver][SQL Server]The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.
So I suppose my long-winded question is, how can I determine why this SP fails for the one company? If relevant, the job is simply:
EXEC procStmtDataToReno 'B'
and some snippets of the SP:
CREATE PROCEDURE [dbo].[procStmtDataToReno]
@CoCode as varchar(2)
AS
--various declarations and such
DELETE
FROM [10.1.1.4].OnlineAR.dbo.StatementData
WHERE CompanyID = @CoCode AND (Line1Date < Convert(varchar(10), GETDATE() - 60, 101) OR Line1Date >= Convert(varchar(10), GETDATE() - 5, 101) )
--code to build temp table
INSERT INTO [10.1.1.4].OnlineAR.dbo.StatementData
SELECT * FROM #Statement
GO
TIA
View 3 Replies
View Related
Mar 26, 2014
1. Take a subset of data from about 100 tables that have multiple references to other tables in this group of 100 from a first DB.
2. Insert the above data into a second DB, a database that already has data in the 100 tables, while maintaining the correct references.
As a general approach, the best way I can think of doing this is as follows:
1. Create mapping tables for every ID that is referenced in a different table (OldID NewID)
2. Insert the old data into the new table and output the OldID and NewID into the mapping table.
3. Use that mapping data to make sure all tables that use those IDs have the new IDs in DB2.
This approach is extremely labor intensive both on initial implementation and would require a fairly substantial amount of work to maintain going forward.
View 7 Replies
View Related
Sep 10, 2001
Hi all,
I got a situation here.....
From a source table (in SERVER1) I get ids of candidates and from another source (in SERVER2) I get their CVs (text files stored in various Folders). My destination table (in SERVER3) has two fields, CandidateId & CandidateCV.
I have to transfer the data in above fashion for nearly 1 million records.
How can I write a DTS package which picks up the text file from SERVER2 based on the CandidateId which comes from SERVER1? Probably I need some kind of looping mechanism which changes the candidate id & his CV file.
Can anyone help???
Thanks...
View 2 Replies
View Related
Jul 15, 2014
I've two SQL databases, the first one having the schema named sch1 and the second one with the schema named sch2. I need to copy data of more tables belonged to the sch1 into the sch2 of the second SQL Server db and I'd like to create a SSIS 2012 pkg in order to achieve this goal.
View 2 Replies
View Related
May 8, 2006
An SSIS package to transfer data from a DB instance on SQL Server 2005 to SQL Server 2000 is extremely slow. The package uses an OLEDB Source to OLEDB Destination for data transfer which is basically one table from sql server 2005 to sql server 2000. The job takes 5 minutes to transfer about 400 rows at night when there is very little activity on the server. During the day the job almost always times out.
On SQL Server 200 instances the job ran in minutes in the old 2000 package.
Is there an alternative to this. Tranfer Objects task does not work as there is apparently a defect according to Microsoft. Please let me know if there is any other option other than using a Execute 2000 package task or using an ActiveX Script to read records from one source and to insert them into the destination source, which I am not certain how long it might take and how viable will that be?
Any inputs will be much appreciated.
Thanks,
MShah
View 5 Replies
View Related
Jul 26, 2006
When copying data to a remote SQL2K5 destination from a SQL2K5 source database, both using mixed sql server security mode, my job generates the following error:
[Transfer SQL Server Objects Task] Error: Execution failed with the following error: "Cannot apply value null to property Login: Value cannot be null..".
This occurs after the destination database tables have been truncated and replacement data from the source would begin to copy.
The same process can be successfully completed from the Management studio with a simple data export process. However, when I run the saved package again from the BI interface, I get this error.
My search engine searches have yielded numerous hits of others having the same problem with one microsoft rep indicating it was a bug and would be resolved in sp1. I am working with sp1. Oddly, there is only mention of this in the forums. No KB article from MS addresses the problem and I do not see it addressed elsewhere at sqlservercentral.
It appears that others have switched to Integrated Security and resolved the problem. However, I do not have that option with a remotely hosted database.
Does anyone have any information concerning this problem?
View 1 Replies
View Related
Jun 29, 2015
I am trying to copy the data from Oracle to SQL, it is taking 10 mins to load only 50K records of data. I am using only one DFT task.
In the DFT task I am using 2 tasks oracle Source and OLEDB destination .
 what can I do to improve the ETL process and reduce the load time ?
View 5 Replies
View Related
Nov 14, 2007
I Have a problem when copying data from one server to another in Management studio, I need to create and exact copy of the original because of primary key relationships,
Currently when I export the data the data will run through an insert type statement, which means that all PKs are reissued, rather than being duplicated from the original, How can I be sure that the data will be copied exactly how it is on one server to the other.
View 4 Replies
View Related
Jan 2, 2008
i've created a package that will copy data from an oracle table to a sqlserv table (that table elemenst are identical), when i click on the connecting line between the two connections it executes without any errors, but nothing is copied, when i try to execute the package i'm getting an error... where can i go to find out what's causing the error. There is no error message or number returned from dts, all i get is a red 'x' . There are 1236 records that need to be inserted and when i get the red 'x' it tells me 1236 records have been processed. When i click on tranformations and select test, it works, but since it's a test nothing is actually copied. I've got other packages that i've created that do the same thing with other tables and they work. I tried just copying one record and that worked, so i assumed it must be data dependent, i've checked all the fields and made sure they weren't null, i've checked to make sure there aren't duplicate primary key records. Without knowing what the actual error is I'm stumped ???
View 4 Replies
View Related
Mar 30, 2007
Is it possible to easily copy data from one table to another if the data types don't match. I know you can do a INSERT INTO table1(col1,col2) SELECT (col2,col7) FROM table2 if the data types match but is there a way to do this if they don't. I'm not trying to copy date times into bit fields or anything. I just have an old table that I built when I really didn't know what I was doing now I at leastthink I have a better understanding of what data types to use, so I was wanting to move the data in the orignal table to my new one. Most of the fields in the olddatabase are text datatypes and the new database is nvarchar(50) data types. Thanks for any suggestions.
View 4 Replies
View Related
Apr 28, 2006
I've got two DBs in the same SQL instance. They are named TST and PRD. I am using 2.0 so there are many ASP generated tables also. Every once in a while I want to refresh data from PRD to TST. But I don't want to copy the data from ASP tables.What is the easiest way to do so?
View 6 Replies
View Related
Oct 10, 2006
Rene writes "Good evening. This is my first time using sqlteam for answers and I'm hoping I can get some much needed direction.
Basically what I am trying to accomplish is taking records from a temporary source table to a permanent table. Here is what the tables look like (oversimplistic version)
tblTemp
ID
Value1
Imported
FailedReason
tblPerm
ID
Value1
Basically I would like to take the values from tblTemp and INSERT them into tblPerm. The catch is that values in tbltemp might violate primary key constraint because of duplicate values in the ID field. The value1 field is required in tblPerm and it might contain a null value on tbltemp causing the insert statement to fail.
What I would like the end result to be is that any records which are INSERTED from tbltemp to tblperm are flagged with a value of imported=1 on the tbltemp table. Any records which fail should then be flagged as imported=0 and failedreason=reason for failing.
I am trying the following to start with but am not sure if I am steering in the right direction or not. The process should be as automated as possible, perhaps part of a scheduled dts package or likewise since new data will be inserted in the tbltemp table on a weekly basis.
set rowcount 1
update tblsource set imported = 0 where imported is null
insert into tbldest (col1, col2)
select top 1 col1, col2 from tblsource where imported = 0 and notimportreason is null
IF @@Error <> 0
GOTO ErrorHandler
UPDATE tblsource SET imported = 1 where imported = 0 and notimportreason is null
ErrorHandler:
update tblsource SET notimportreason = @@error where imported = 0 and notimportreason is null
RETURN"
View 2 Replies
View Related
Mar 10, 2008
HiWe use Sql Server 2000.Is there a way to copy and entire text file into a database tablewithout using a DTS ?
View 2 Replies
View Related
Nov 1, 2007
HI,
I just copied sm data from a table in a DB to a flat file which I have created previaouly in my documents in my local machine.
I used the following command.
C:Documents and Settingsshamen> dbname.tablename out flatfile.txt -T
Once I run this it prompted two questions asking pre-fix lenght and field terminator. I jsut accepted the default values.
After I run it, it copied data. But when I see the flat file , I did not see data in that file.
To where data has been copied?
it says 10000 rows succesfully bulk-copied to host file. Total received 6176000.
But I dont see data there now.
View 5 Replies
View Related
Jul 25, 2007
Is there any simple way to copy tables from one database to another in SQL Management Studio or VS 2005? I sometimes work split work between home and work and I often need to copy and table and its data (data, stored procedure, etc) to a different database, but having to create a new database then copy the data is a pain. Is there an easier way?
View 5 Replies
View Related
Sep 2, 2002
If I have to copy data from one database to a temporary database on the same server, which transaction log will be written to as a result? Will it be the DB that the command is run from, the source DB, or possibly tempdb's log?
Thanks
Derek
View 1 Replies
View Related
Oct 31, 2004
hi all,
i have a dts that copies table contents from remore server to local server.
remote table:
ItemID|name
1 |name1
2 |name22
3 |name33
local table:
ItemID|name
1 |name1
2 |name2
i want that the dts will only copy the new rows( aka. row with ItemID = 3) and leave the other rows a they are.
can any one help me create such a dts.
please help!
View 1 Replies
View Related
May 1, 2007
Hi All
Iam using sql 2005 and am new to it, I want to copy a table and data from server to another, how is this possible?
Many Thanks in advance....
View 2 Replies
View Related
Oct 16, 2007
Hi All,
I wish to copy between 2 tables in different databases.
( The source and destiantion tables already exist)
The source table has duplicate entries which i want to avoid from being copied to destination table.
How can i achieve this?
Thanks in advance..!!
Vishu
View 20 Replies
View Related
Jul 20, 2005
I have to setup some scheduled tasks to copy 3-4 tables from anSQL2000 database to DB2 v. 8.1.The job must run every night replacing all data.How can this be done - with standard utilities??Please be exact - I'm new to this.Thank for any help./Jep
View 1 Replies
View Related
Jan 25, 2007
Yet another very much newbie question I suspect€¦.
I want to know how I copy data from one field in one
DataBase to another field in another DataBase??
Basically I have an ASP driven forum, and want to upgrade to
a new ASP.NET forum€¦ Problem is obviously the DataBase structure is different
and I don€™t want to loose all the data from my current forum€¦ So I would have to pick which table field
needs to be copied to where in the new DataBase..
Is this easy to do??
I will be using SQLExpress 2005??
Thanks
View 1 Replies
View Related
Oct 4, 2007
Hello everyone!
I have two servers, one is 2005 standard, the other is 2005 express.
I'm using express to record test results and it will be keep recording non-stop.
So, what I want to do is I want to transfer data from express to standard using SSIS package, and as soon as data gets transferred the data to no longer exists in express.
I have a job running the "copy" package every minute, but I don't know how to delete the data in express.
Does anyone know how to help me out pleaseeeee..?
Thanks in advance.
MIKE!
View 6 Replies
View Related
Apr 3, 2006
I have the following table:
Table name: RR
columns:
Subject (varchar (35), Null)
Topic (varchar (35), Null)
RD (text, null)
RR (text, null)
Picture (varchar (50), Null)
Video (varchar (50), Null)
RRID (int, Not Null)
TSTAMP (datetime, Null)
RRCount (int, Not Null)
This table stores common information used in resolving technical problems based on Subject and Topic. However, I've now created a Subject/Topic where I want to copy all the data that corresponds to another Subject/topic.
Example:
There are 35 rows that correspond to Subject = 'Publisher01' and Topic = 'Subcategory03'. I want to create 35 new rows that contain the same RD and RR data, but have Subject = 'Publisher02' and Topic = 'Subcategory07'. Highest current RRID = 5008
I cannot figure out how to write that query. I apologize in advance for the fact that this is, no doubt, a seriously beginner question.
View 1 Replies
View Related
Feb 2, 2007
is there a way to copy a SqlDataSource Data into a dataset?
View 4 Replies
View Related
Apr 15, 2015
We've had a new server set up with SQL 2012 and I'm in the process of moving data to it from a 2008 (SP2) server.
Details are as follows:-
2012 instance:- Microsoft SQL Server 2012 - 11.0.5058.0 (X64)
May 14 2014 18:34:29
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
2008 instance:- Microsoft SQL Server 2008 (SP2) - 10.0.4000.0 (X64)
Sep 16 2010 19:43:16
Copyright (c) 1988-2008 Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: ) (VM)
I don't want to do a backup/restore routine as there are collation conflicts on the 2008 server.I've created the database and tables on the 2012 instance and now I want to transfer the data from the 2008 instance to the 2012 one.
The 2012 instance has a linked server to the 2008 instance.I was trying to use sp_MSForEachTable (I know, it's old and will probably disappear shortly) but that doesn't seem to work properly because some of the columns have an Identity field set up.
Some of the tables have upwards of 10 million records in them and are quite sizeable.how I can achieve the transfer without a back-up/restore?
View 9 Replies
View Related
Oct 25, 2005
hi all
i have two databases on two different machines.
both databses r having same names.
i want to copy data from the table in other database to table in databse on my machine .
how can i do this.
i will be very thankful to receive help.
View 2 Replies
View Related
Apr 19, 2007
Can i do something like this
INSERT INTO CITIBANK.dbo.Contract (*)
FROM exec sp..
where sp is the stored procedure ?
Or do i need to specify all the colums where the * is ?
and if so is it the columns from the SP or the colums
from the destination table ?
View 4 Replies
View Related
Jul 23, 2005
Hi all!I have an application that needs to copy the database structure fromone database to another without using the "Generate SQL Script"function in Enterprise Manager. I'd like to do this from within astored procedure. Can someone recommend the best approach for this?I've seen references to using SQL-DMO from a stored procedure using thesp_OA* procs in other postings to this group but was wondering if therewas an easier way? Can I use bcp and then use xp_cmdshell from withinmy stored procedure? It's not clear to me from the documentationwhether bcp copies both structure and data or just data? Is there abetter way?Thanks in advance for any help!Karen
View 1 Replies
View Related
Sep 7, 2006
Hi. I need to move data from one database table to
another across database instances. A simple example of the typical
move would be:
[CODE]
INSERT into destination_db.dbo.table1
SELECT column1, column2, column3, column4 from source_db.dbo.table2
[/CODE]
My options are:
1. Create an SSIS package to perform the move.
2. Create sprocs and schedule the data move as jobs.
3. Write .NET code using sprocs to perform the move.
I'll have to move hundreds of thousands of records, so I want the
option that provides the best performance. I'm guessing that option 3
will be the slowest.
Thanks for the help!
View 4 Replies
View Related
Jul 24, 2006
I'm trying to copy a data base from one server to another. Both servers are running 2005 MSDE, on Win 2k3, the target server is 64 bit.
I'm using the Copy Database function, and ultimately it fails with the error in the event viewer in the targe machine:
Faulting application dtexec.exe, version 2005.90.1399.0, stamp 43500d1a, faulting module kernel32.dll, version 5.2.3790.1830, stamp 42438b79, debug? 0, fault address 0x0000000000027d0d.
I have tried both the Attach/Detach & the SMO method, and they both give me the same error. I have 'Repaired' the .NET framework on the target machine, with the same result.
Does anyone have any Suggestions? I really only need at this time to make one copy of the database.
Thanks
Phil
View 5 Replies
View Related