Mapping One Table To Another In Diffirent Databases
Jan 14, 2004
I want to map a table1 in one database to a table2 in another database. That way I can populate the table2 with the information that table1 has. How would you go about doing this. Very new at this and need help! Thanks alot .
View 4 Replies
ADVERTISEMENT
Mar 30, 2004
I know there maybe something similar of what im asking for but i just cant find it.
I have 3 Stored procedure.
SPA - create a temporary table "sp_getListOfChildren"
SPB - insert the data into the temp table "sp_InsertCategoriesFound"
SPC - display the list of categories i found "sp_ListingAvailableCategories"
process:
SPA call SPB and SPC call SPA
my problem is in the SPC. it seems that the table doesnt exist anymore when i do a select but in the message tab of my sql analyser i can see that the table have some data before executing that store proc..
Invalid object name '#TblTempCat'. for my SPC !! ??? why.. how do i detect a temp table in diffirent stored procedure per user and as to be temp table.. for multiple access.. "WEB"
============MY "SPC" CODE=============
alter PROCEDURE sp_ListingAvailableCategories @CurrentCategoryID AS uniqueidentifier
AS
exec sp_getListOfChildren @CurrentCategoryID
select * from #TblTempCat
select * from TblCategories where CatID not in (select CatID from #TblTempCat) and CatId <> @CurrentCategoryID
View 7 Replies
View Related
Aug 25, 2006
Hello,
I have a requirement to link two databases on the same server. Besides using the microsoft link option is there any other method by which we can link these two databases. Responses will be highly appreciated.
Thanks
View 3 Replies
View Related
Oct 29, 2005
Can Use Fieids of diffirent datasets in a matrix ? SUM(Fields!a.value) is invalid?
View 4 Replies
View Related
Mar 19, 2008
Hi Friends,
I have a small problem in parameter mapping for Execute SQL Task.
I am using a delete statement with 2 conditions.
Followed by another Execute SQL Task which contains commit statement.
delete from tname where c1 = ? and c2 =?
where c1 is number(4) datatype and c2 is of varchar2(20) datatype in oracle.
The connection manager i am using is ORacle OLE DB provider.
I am passing 2 global variables i.e g_v1 of Int32 and g_v2 of String Type.
In the parameter mapping of the Executing SQL task, i am mapping these 2 variables for
c1 and c2 and changed the datatypes inside parameter mapping as Numeric for c1 and Varchar for c2.
I also set the property as ByPassPrepare = True.
When i am executing the package i getting INVALID NUMBER ERROR.
i believe the SSIS is unable to perform the implict datatype converison.
For the next run, i changed the g_v1 varible datatype to Double and also i changed the parameter mapping for c1 as Doble datatype.
This time it is working fine. I can see the Green signal for the 2 SQL Tasks.
But when i connected to Oracle check the count in the table, the data is not getting deleted.
Also,
I set the property RetainSameConnection = TRUE for oracle connection manager.
I am not able to trace this logical error.
The same is working fine in my local machine.
But i am facing the problem when i deployed the same on the client machine.
Is there any problem with parameter mapping?
What should be equialent Datatype for Oracle NUMBER datatype that should be used inside the SSIS package while declaring the global variable and
inside the parameter mapping.
Any thoughts!
View 5 Replies
View Related
Dec 26, 2007
hi friends..
i want to insert data in sql server2005 table through asp.net
column names of this table comes from diffrent tables.....
like Rollno--- in my new table....but in old table1 this is like RNO & from old table2 this is R_no
so i want insert this two old diffrent table data into my new table...but i have problem coz of diffrent column names of old table...
can you help me 4 that...
View 3 Replies
View Related
Apr 17, 2008
Hi Guys
I have a table that contains codes for commodities.Some of the codes in this table have changed and some of them have not.So now i want to design a solution that enable me to map the new codes in a different mapping table to the old ones in the other table.I also want to retain the old codes because most of the archived data used the old codes.
The New code is the new code to which the Code must be mapped to.Where there is no new code, the current code is being retained.How do i design my table and queries so that i can use the new codes as if i was using the old code.I want to select products with a certain code but using the new code and mapping to the old codes or vice versa.
Please help.
The structure of the data is like this.
New Code
Code
Name
GO01CCN
Gas Oil
XAA
AA
AA
XAL
AL
Aluminium
XMA
ALM
ALM
XAL
ALT
Aluminium in tonnes
XAR
AR
AR
AUD
Australian Dollars
AUJPY
AUJPY
??
CAQ
CAQ
XCC
CC
CC
XCU
CCF
CCF
CER
Carbon Emmission Reduction
Coal
COAL
XCR
CR
Copper Repo
XCT
CT
CT
XCU
CU
CU
XCU
CUC
CUC
Thanks in advance
View 3 Replies
View Related
Apr 18, 2008
Hi Guys
I have a table that contains codes for commodities.Some of the codes in this table have changed and some of them have not.So now i want to design a solution that enable me to map the new codes in a different mapping table to the old ones in the other table.I also want to retain the old codes because most of the archived data used the old codes.
Where there is no new code, the current code is being retained.How do i design my table and queries so that i can use the new codes as if i was using the old code.I want to select products with a certain code but using the new code and mapping to the old codes or vice versa.
The structure of the data is like this.
Code Name
AA AA
AL Aluminium
ALM ALM
ALT Aluminium in tonnes
AR AR
AUD Australian Dollars
AUJPY AUJPY
CAQ CAQ
CC CC
CCF CCF
CER Carbon Emmission Reduction
The mapping table is like this:
XAA AA
XAL AL
XMA ALM
XAL ALT
XAR AR
In god we trust,everything else we test.
View 8 Replies
View Related
Oct 1, 2006
HI guys
I need to put multiple coniditions on my table based on some combinations.
Here is my main table-
Practitioner
DHBName
PHOName
Practicename
PractitionerName
Locum
YCount
NCount
4
Canterbury DHB
Partnership Health (Canterbury)-596721
Linwood Avenue Medical Centre
Christine Abbasi
No
0
1
32
Canterbury DHB
Partnership Health (Canterbury)-596721
Felicia House Clinic (Pearson)
Nicci Pavey
No
0
1
197
Canterbury DHB
Partnership Health (Canterbury)-596721
Woodham Road Health Care
Peggy Shelton-Agar
No
0
1
394
Hawkes Bay DHB
Hawkes Bay PHO Limited-587862
The Doctors Napier
John Laird
YES
1
0
549
Canterbury DHB
Partnership Health (Canterbury)-596721
Linwood Avenue Medical Centre
Denise Armstrong
No
0
1
1286
Canterbury DHB
Partnership Health (Canterbury)-596721
Darfield Medical Centre Limited
Katherine Muscroft-Taylor
No
0
1
1501
Counties-Manukau DHB
Procare Network Manukau Limited-573183
Manukau City Health Centre
Caroline Shephard
YES
1
0
1932
Hawkes Bay DHB
Hawkes Bay PHO Limited-587862
Clive Medical Centre Ltd
Karen Irwin
YES
1
0
2226
Canterbury DHB
Partnership Health (Canterbury)-596721
Sumner Health Centre
Anne Scott
No
0
1
3243
Waitemata DHB
Harbour PHO Ltd-610733
Byron Medical
Rex Livingstone Sinclair
No
0
1
3263
Canterbury DHB
Partnership Health (Canterbury)-596721
Sumner Health Centre
Peter Wynn Nicholson
No
0
1
3381
Otago DHB
Otago Southern Region Primary Health Organisation-597004
Dr Visagie's Practice
Fay Young
NO
0
1
Here is my mapping table-
Locum Flag
No count
Yes count
Percentage
No
1
0
1
No
1
1
0.75
Yes
1
1
0.25
No
2
0
0.5
No
3
0
0.3333
No
4
0
0.25
Yes
2
1
0.125
No
2
1
0.75
Yes
0
1
0.75
Yes
0
2
0.375
Yes
0
3
0.25
Yes
0
4
0.1875
I have to add an additional column called 'percentage' in my main table by refering the mapping table.
For ex for a particular practitioner, Locum flag is 'Yes', nocount is 1 and yes count is 1, then percentage should be '0.25'
How should I do this??
View 6 Replies
View Related
Jul 23, 2005
I've just found a blocking lock occuring in a SQL Server.[color=blue]>From the waitresource, I found that the blocker has the following[/color]information:wait_info: PAGEIOLATCH_EXwait_resource: 14:1:564312And the blockee has the following information:wait_info: LCK_M_Swait_resource: KEY: 14:405576483:2 (7501a5aa8355)The problem is that I do not know which object is the blocker holding,for I understand that for a PAGE lock, it is in the format ofdatabase_id:file_id:page_idI know the db_id, the file_id but don't know how to map the page_id(564312) to a table/index in the database.Can somebody shed some lights on this? thks a lot.
View 4 Replies
View Related
Jun 1, 2015
I have a requirement to take xml file, in case the number of column changes, it should not fail the package, rather it should load the data in destination table. Destination table could be altered separately depending on xml schema by the DB team in production.
View 3 Replies
View Related
May 18, 2011
Have to create SSIS package for the below requirement:
I have source data in 2 excel files. Data from both these excel files should be loaded to the same single Fact table.
The column names in excel files and table are not same. I have a Reference table which has the column mappings between excel and Fact Table.
I have to refer this Reference Tabel for column mappings, plus i have to add some derived columns (Created_Date) to load the Fact_Table.
I have given a sample data structure below:
Source Data
Excel1_Order.xls
OrderNumber OrderQuantity OrderDate
Order10001 100 01-01-2011
Excel2_Customer.xls
CustomerNumber CustomerName CustomerAddress
[Code] ....
Is there any way to handle this in SSIS?
View 16 Replies
View Related
Sep 8, 2015
The only way to add a new column to an existing mapping that I know is to go to advanced editor and refresh. This however keeps only the default mapping (where the field names match), the rest is wiped out, so need to restore the mapping manually after that. Risky and annoying at the same time. Is there any alternative?
View 3 Replies
View Related
Aug 16, 2007
Hi,
I use lookups to map surrogate of level 1 dimensions to my fact tables in SSIS.
But how to handle a level 2 dimension with a ValidFrom and a ValidUntil date field?
I do not use an IsCurrent column, because this could problem with late arriving facts.
- In dts I used an SQL statement like this:
update SA
SET SA.DimProdRef = Dim.RecordID
FROM SAWarenEingang SA, DimProd Dim
where SA.ProduktNumber = Dim.ProduktNumber
and SA.ArtikelkontoBewegungsdatum between Dim.ValidFrom and Dim.ValidUntil
Now in SSIS I want to handle the whole thing in the data flow without using a staging table:
- Using Lookups: I would have to pass the date column for each inside the fact table into the lookup. That does not work.
- Using Execute SQL in the data flow: would be very slow, because the statement will be executed for any line in the dataflow
Any ideas?
Best regards,
Stefoon
View 10 Replies
View Related
Nov 5, 2015
I have dimension data like this
persn_key persn_id address is_active updated_date
1 10 NYC 0 2015-11-04 14:19:54.817
2 10 Chicago 1 null
and Fact table like
fact_key persn_key units_purchased
1 1 10
persn_key is the surrogate key between tables.
My question here is as the dimension has SCD type 2 on it and every time when there is a change the persn_key gets a new key value but the fact table still points to oldest key.how to update the surrogate key on fact table to the current key value? As per the requirement fact surrogate key must be pointing to current active record on the dimension.
View 6 Replies
View Related
Apr 4, 2008
I'm in the process of converting legacy DTS packages to SSIS. I need to populate a table that has more fields than the source file. In DTS I did this with an ActiveX script. How do I go about doing this within SSIS.
In the ActiveX script most of the fields were defaulted with either spaces or zeroes.
One of the Destination fields needs to be incremented by 1 for each new record inserted.
Any help would be appreciated.
Thanks,
Jeff
View 6 Replies
View Related
Apr 16, 2008
I would like to join table in different databases with a primary key and query it. How to do ?
View 3 Replies
View Related
Apr 16, 2008
I'm a VB.net programmer working in an environment that doesn't have a true sql db administrator. We have a situation where we're thinking about adding a new database (db2) with the same Tables used in an existing database (db1). We were hoping to avoid this, but circumstances are forcing us to think about it. Are there any sql tools out there to maintain a dual-db like this? What are the main disadvantages to this?
View 3 Replies
View Related
Jan 23, 2004
i need to create a rowset containing database names where a particualr table name exists.
ie. in Oracle i would select owner from sys.all_tables where table_name='MYTABLE'
I know master.dbo.sysdatabases contains my owners, and in each database sysobjects would identify MYTABLE ..
sp_tables only lists those in the current database, but i want to list all databases that contain MYTABLE
a single select statement would be nice.
View 14 Replies
View Related
May 1, 2007
Dear Folks,
Is it possible to update sys.databases table?
i need to update one column in this table.........
but it is showing some error
Msg 259, Level 16, State 1, Line 2
Ad hoc updates to system catalogs are not allowed.
how can i update this table?
Vinod
View 4 Replies
View Related
Jun 4, 2007
Hi,
I'm quite new to MS SQL and am having a few problems I hope someone here can help me with.
I've created a small web application that enables users to backup and restore databases easily.
There is one table that holds information about the backups that have been taken and one table that holds details about each database (name, location etc)
What I want to do is have a web interface that allows a user to link a new database (one that is already attached to SQL but) to the system by inputting it into the database details table.
Ideally this will be a drop down menu that shows the databases attached to the server that arnt:
1. Already in the backup system table
2. Not the system databases.
This will allow the user to easily select the database and give it a title (usually different from the local name of the database) for identification.
The database local name, and title would then be input into the database details table.
I'm thinking that I need to use a SELECT statement, but I'm not quite sure how I can restrict the results to databases that arnt already attached or already in the system.
I hope that wasn't too muddled an explanation!
Thanks,
Steve
View 8 Replies
View Related
May 4, 2007
What is the best approach to handle this situation? I have three different databases, which has it's own stored procedure. I need to call them all at page load and piece together the data. The common demoninator is the date.
2007
JAN
FEB
MAR
APR
row 1
50
60
89
63
row 2
44
21
62
46
2006
JAN
FEB
MAR
APR
row 1
60
90
65
41
row2
984
650
452
762
Row 1 and Row 2 come from two different databases and stored procedures.
How can I query the data and present it as it's shown above?
Thank you!
View 10 Replies
View Related
Jul 8, 2005
I need to learn how to move or copy a couple of tables from one database to another. The tables are defined but contain no data.
View 2 Replies
View Related
Mar 6, 2000
Hi,
Is there a query I can run to retrieve a list of all tables and their sizes in a database? I want something that is like the feature in Enterprise Manager when you click on a database and then the 'Tables & Index' link. It lists the tables and their respective size. I want to push this into a spread sheet.
The reason why I am doing this is the compare data between 2 different databases. Since I cannot find a tool that will compare the data, the closest I can get (without bcp-ing out all data and comparing) is to look at the sizes of each table.
Thanks!
Joyce
View 2 Replies
View Related
Oct 20, 2000
Hi
I have a problem out here. I have two databases with the same table structure
and I want to merge data from both the tables . Please can anyone let me know.
Iam using Sql Server 7.0.
Thanks
Bye
View 1 Replies
View Related
Oct 26, 2005
Hello EveryoneWe have a third party tool which maintains its own customdatabase,DB1 on SQL Server 2000 on Server A (Windows 2000). We built aninhouse application which maintains a transactional database, DB2 alsoon Server A derived from DB1. Since the DB1 is frequently updated thesynchronisation between the databases is currently maintained by usingviews in DB2 which pulls in all the required data from across tables inDB1.But we found that the cost of employing views, referencing tablesacross databases has made the inhouse application slower and so as aapparent performance tuning measure we plan to maintain a subset ofdata(for a specific time period) from DB1 in actual tables with sameschema in our transactional database DB2. But since the tables in DB1are frequently updated during the day we are required to thesynchronise the corresponding tables in DB2 with their counterparts inDB1. The only constraint in this synchronization being that the thirdparty custom database,DB1 cannot not be subjected to any changes (likecreation of triggers) as it is maintained by a different group ofpersonnel.I read about Triggers,Maintenance Jobs and Replication but not surewhich would suffice our needs.Are there any recommendations on how thiscould be carried out? Any suggestion would be welcome.Thankschandra
View 1 Replies
View Related
Dec 5, 2007
I have several databases that are used to collect data for differentclient-projects. My intention was to collect the data, and administermySQL so each client could see only their data. Each of thesedatabases used to collect data have the same tables. There are otherdatabases which are available to all the users which contain commoninformation.The command "show databases" lists all of the databases (visible tothe particular user) and not the one's I would like to display (thedatabases used to collect data). Is there a way to nest a singlemySQL command to show only the databases that have the same particulartable?
View 1 Replies
View Related
Dec 3, 2007
In a package we have statements pointing to 2(or more) different databases on the server. When moving between environments, is there an easy way to change statements like:
UPDATE t1
SET t1.name = t2.name,
t1.age = t2.age
FROM DB1..Person t1
INNER JOIN DB2..PersonToo t2
ON t1.PersonID = t2.PersonID
I can think only of building the statements replacing the database names with variables, but that's not an easy way. I do not know how to use package variables in this situation.
1 way of doing this may be by using a Lookup or Conditional Split and use the resulting dataflow in a SP or such to update, using parameters...
It all sounds very messy, and I still don't know how
Any ideas?
TIA,
View 7 Replies
View Related
Apr 20, 2006
Hi champs!
Is it possible to make a database View over two different database installations on different machines?
Many thanks
kurlan
View 4 Replies
View Related
Aug 20, 2007
Hi everybody.
I need to find all the views that depend on a table in a different database, in order to refresh them once the table is altered.
In the BOL I found the following script that is very useful, but I can't use it if the view and the table are in different database.
Where can I find the dependencies in this case?
Thank you very much.
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/9ce1d07c-ee66-4a83-8c73-cd2cc104dd08.htm
Creating a script that updates all views that have dependencies on a changed object.USE AdventureWorks;
GO
SELECT DISTINCT 'EXEC sp_refreshview ''' + name + ''''
FROM sys.objects so INNER JOIN sys.sql_dependencies sd
ON so.object_id = sd.object_id
WHERE type = 'V'
AND sd.referenced_major_id = object_id('Person.Contact')
View 1 Replies
View Related
Jun 3, 2015
I am very well versed on manipulating data using passthrough queries through access or the command object in ADO/VBA but this problem requires a sql server side solution and I have been assigned the task
Scenario
Access via an ODBC link cannot view Sql table data that uses a BigInt as a primary key. Access can update the data, insert data ands delete data to these tables - but viewing (by design) returns the actual count of the rows but each field is populated with #deleted.
I can view the table data if I use a passtyhrough query but performing row level and field level edits from there is impossible. Not all people have Studio manager so that is not an option.
We are moving away from our legacy application and the development company has already developed the schema using the BigInt so changing that to a numeric or integer is out of the question. My boss has determined that using a set of bridge tables with identical tables in a different database where we replace the bigint with int will work - we can view the data in the "bridged" database and even update it from select queries and simply by opening the table in view mode from Access.
Here is the hard part (for me) because I have never done this. I can write SQL and understand the security/roles etc, but I have never administered SQL server regarding server side triggers and stored procedures - I have always used the command object or passthrough queries to deal with sql stored procedures. I need to either
A)Create some trigger behind the tables in my bridge table that will fire a stored procedure to replicate the data to the bigint database. They are both on the same sever.
B)Somehow create a "mirror" that always replicates from my bridge database tables (5 of them) to the new database.
View 3 Replies
View Related
Feb 11, 2006
HiOur product uses MS-SQL Server 2000. One of our customer has 10installations with each installation stroring data in its own database.Now the customer wants to consolidate these databases into one and wealready have plan for that by consolidating one DB at a time. But firstthey want to find how many unique or duplicate entries they have acrossall the 10 databasesAssumptions:1. All the databases reside on the same server. (This is just anassumption, not the real environment at customer site)2. Databases can not be merged before it is found how many unique orduplicate rows exist.Table under consideration:Message(HashID PK,....)# of rows in Message table in each of databases: 1 MillionHere is my question: How can I find how many unique or duplicateentries they have across all the 10 databases. I easily find uniquerows for two databases with a query like this:SELECT COUNT(A.HasID) FROM db1.dbo.Message A LEFT OUTER JOIN ONdb2.dbo.Message B ON A.HashID = B.HashID WHERE B.HashID IS NULLHow can I do this for 10 databases. This will require factorial of 10queries to solve this problem.I will appreciate if someone can provide hint on this.RegardsAK
View 3 Replies
View Related
Nov 9, 2015
I am trying to join two table from two different databases.
Database 1 = Agent and Table = Stats
Database 2 = Amount and Table = Sales
The common field is Expr1 (table1) and Initials (table2)
View 7 Replies
View Related