Importing Partials Datas From 2 Tables In Another One
Nov 12, 2005
I am having a problem to get all datas into one table
I must get datas from 2 other tables
datas from the first table are columns
but datas of the second table are rows
I cannot change the structure of TableA because an other application is using it as it is
TableA
num | value | key
1 | a | 1400
2 | b | 1401
3 | c | 1402
4 | d | 1403
...|... | 1403
TableB
key | name | descr | value
400 | john | ok | 451
TableC (the table where I want to insert datas from Table1 and Table2)
val1 | val2 | val3 | val4 |name | descr | value
1 | 2 | 3 |4 | john | ok | 451
TableA has thousands of rows and different numbers
I must get 8 different datas from TableA
so I get an horrible Query !
SELECT
TableB.name, TableB.descr, TableB.value,
TableA_1.value AS val1,
TableA_2.value AS val2,
TableA_3.value AS val3,
TableA_4.value AS val4,
TableA_5.value AS val5,
TableA_6.value AS val6,
TableA_7.value AS val7,
TableA_8.value AS val8
FROM dbo.TableB INNER JOIN
dbo.TableA_1 ON TableB.key = TableA_1.key INNER JOIN
dbo.TableA_2 ON TableB.key = TableA_2.key INNER JOIN
dbo.TableA_3 ON TableB.key = TableA_3.key INNER JOIN
dbo.TableA_4 ON TableB.key = TableA_4.key INNER JOIN
dbo.TableA_5 ON TableB.key = TableA_5.key INNER JOIN
dbo.TableA_6 ON TableB.key = TableA_6.key INNER JOIN
dbo.TableA_7 ON TableB.key = TableA_7.key INNER JOIN
dbo.TableA_8 ON TableB.key = TableA_8.key
WHERE TableA_1.num = 145
AND TableA_2.num = 80
AND TableA_3.num = 3160
AND TableA_4.num = 41
AND TableA_5.num = 50
AND TableA_6.num = 51
AND TableA_7.num = 53
AND TableA_8.num = 56
I am a student in a compagny because it´s my training. But, I must use MS SQL server and i don´t know at all this software ! I must import datas , which are in a ascii form, into MS SQL serveur 7,0.
Can you give me further information please, because it´s not easy at all ! thanks
Hi guys,I have a problem with my query. What i want to happen is to populate my table EV_NOTIFICATIONDETAILS (Docownerid, CurrentSentDate, LastSentDate, detailsID, GeneralRemarks) using the datas from the two different tables EV_NOTIFICATIONHEADER and EV_DOCDETAILS.I tried to create some a query but im having a error. The problem is once i insert the data from datas to the columns Docownerid, CurrentSentDate, LastSentDate the datas are stored in the database and when i tried to insert the remaining columns TO EV_NOTIFICATIONDETAILS detailsID, GeneralRemarks getting the datas from EV_DOCDETAIL it creates a new set of records in the database. Meaning it doesn't update the records in the table EV_NOTIFICATIONDETAILS but it creates a new set of records.here's my code:INSERT INTO EV_NOTIFICATIONDETAILS (Docownerid, CurrentNoticeSentDate, LastNoticeSentDate) SELECTDocownerid, CurrentSentDate, LastSentDateFROMEV_NOTIFICATIONHEADERINSERT INTO EV_NOTIFICATIONDETAILS (detailsID,GeneralRemarks) SELECTdetailsID,GeneralRemarksFROMEV_DOCDETAIL Any ideas and suggestions will be greatly appreciated.
Hi, I've just got my brand new shiny SQLServer and would like to set some new tables set up etc. But I'm really lazy and I was wondering if there is any way of importing table layouts, coulmns, whole structure type thing into SQLServer from Microsoft Access using DTS? I know it's a bit optimistic, but just wondered....
Not sure if this is the correct Forum, anyway lemme me know your views. I have SQL Server running in two remote machines (in different geographical locations). I need to import a database from one SQL Server installation to another installation. What is best possible solution:
1) Transfering the .mdf and .ldf file from one installation to another installation
2) Generating the records of all the tables in the database to a common file format CSV and then loading it in destination database. If this is ok then how to generate import and export data using CSV format
HiI am new to SQL and am having problems importing data from two tables to one.I have 3 tables : Franchise, Club and Reference.Franchise has FranchiseID as Primary key and FranchiseNumber as unique.Club has ClubID as Primary key.Reference has a combination of ClubID and FranchiseNumber as primary key. I am not able to insert data into table Reference from Franchise and Club. Any help or suggestions would be highly appreciated. Thanks in advance.
hello, i have a problem after importing my db tables to the aspnetdb the default database that come with visual studio i put my tables into that db but i added some columns to the aspnet_users and i made a relation between my tables and some of aspnetdb tables the problem is when i drag and drop a grid view and manage its datasource i cant find the columns that i add to the table? second problem is when i press the advanced button in the datasource the two checkboxes are not active i dont know why and i clicked on the column that has the primary key but i still have the problem i cant update or delete records and i tried on the original aspnetdb users table(without my columns or anything) also found that two check boxes not active? is it a problem in the aspnetdb or what? there also something strange when i choose the tables in the sqldatasource the aspnetdb tables names are appear like this : vw_aspnet_roles vw_aspnet_users ...etc they all has that vw word dont know why it also exist in the original aspnetdb, so hope anyone can help cos if it's no solution for that problem i will have to build my db again from the begining ,hope u reply soon.thanks
I am trying to import application tables from oracle but they do not show up in the list of tables. I suspect that this is because the tables are owned by System. Is there any way other than changing the owner to get these tables to appear in the import list?
I'm making an application in Delphi that use an SQL database, i want the user can import a table in DBF format (that its located in another computer) to the SQL Server (in the database that i want) by one click of a button.
I try with the import wizard but its not what i want because it requiere to do the process manually. Its there anyway of achive this (Stored Procedure or something?)
Ernesto Cisneros Sanchez Senior Software Engineer Credit and Trade Bank Havana, Cuba
i'm importing tables from another sql server - now the tables are coming is as esther.tablename (my username on the other server) instead of dbo.tablename
I'm trying to input a few thousand flat files into a few thousand tables in a sql databaseim using integration services with a for each loop to read all the files in a directorythe problem is i can only insert the data from all the files into one tabledoes anyone know a way to do multiple tables? maybe using some sort of variable?
I've got a csv that I need to import. It's about 74 columns wide and 2500 rows long. What I need to do is select the first 3 columns from the columns from the csv and put them into one table and then put every 7 columns (plus the 1st column as the primary key) into a different table.
I've not explained that very well, basically it's like this...
A B C D E F G H I J K L M N O P
1
2
3
4
5
Table 1 Data
cs# A1 fe B1 cl C1
Table 2
cs# A1 desc D1 date E1 pay F1 amount G1 vat H1 total I1 cReq J1
I'm not really sure were to start. I want to import the data nightly into the tables. I've tried to use the import wizard but I can't seem to select the data I want and exclude the data I don't.
Hi! I'm a novice in asp .net I've a SqlDataSource component on an Aspx page.In the associated C# file, I would like to use datas from the query stored in the SqlDataSource component.How to do this? Thanxs :)
i want to get some results but only for one month. like that;
select * from News where PubDate = month(9)
i tried use between dates but i got errors because all of months aren't 30 or 31 days ... For example February is 28 days sometime.. So how can i get a month results...
Hello, i am using sql server ce 2.0 for my device application.but this database sometimes gets corrupt,and i am not working with big size datas,if sdf file's size grow up,sdf file's performance gets knock out. for example: work with 50 mb data..what can i do?please somebody help me ?
hi. this is a beginner question as i am new to databases :)so, I have an access database and I want to take 2 tables from it and copy it to sql server in my ASP.NET application (.MDF file)I have visual studio 2005 installed on my computer and got no sql server 2005 installed on it. what is the way copy 2 tables to the ASP.NET database application?thanks alot guys.
I'm fairly new to MS SQL & I have a problem copying tables from one d/b to another. When I do an import or export select Copy tables, the tables & the data get transferred, but all the Identities are set to NO. My D/Bs have 188 tables & it's a pain to reset all of them manually.
Is there a setting I don't know about that will transfer the tables & maintain the Identity? (I'm using SQL Server Management Studio 9.0)
Windows XP Pro - Sql Server 2005 Management Studio (current) - current visual foxpro oledb driver
I have an origin data folder with many foxpro dbf files
When I go through the "wizard" to import data from the origin folder using the "free table" option, I can locate the folder just fine. The form shows me a list of the files in the folder - but I cannot scroll through the list.
When I select the folder and continue, I test the connection and get a message that it is fine.
Then I go on to actually import tables. The list that is presented of tables that I can import does not include all the dbf files in the folder. There are 207 files in the origin folder, but only a fraction (about 120) of those show up in the list as candidates to be imported. I cannot see a pattern to the ones that are excluded from the list.
Does anyone know what could be causing this strange behavior?
Does anyone know how I can do this? I have 2 tables in an ODBC datasource (INV HEADER) and (INV DETAILS). The relationship on these 2 tables is (INVNUM). I want to import these tables into SQL 2005 on a nightly basis by date. The problem is the date field is on the (INV HEADER) table and not the (INV DETAILS) table. Basically I want to import all the (INV DETAILS) rows that have the same (INVNUM) as the (INVHEADER) but don't know how to do this. I could use a join on the source tables but how would I direct specific columns to 2 different destinations? Any help on this would be great and appreciated. Thanks
Hi, All. For insert new entry...I used dataset and first all entry in dataset then i insert this dataset into datatabel of database. For update edit entry....First i bind tabel to dataset then i update,delete in dataset then i insert dataset to database then there are problem that is there are once again entry of dataset to that tabel. I also solved this problem by delete record which bind to dataset on save(insert )data set to database and then again insert dataset to tabel and solve it. But if any other option for it then plz replay me Thanks
I am going to set up a new SSIS package that will import data into 5 different tables on a SQL Server database. Â The source of the data is on another SQL Server and I will use to select the data. Â If one of the tables fail to import I do not want the SSIS package to import any of the data.What is the best way to create this package? Â Is it best to create one SSIS package, with five data flow tasks that are linked to each other. Â Within each data flow task, is a Source and Destination to transfer the data to each table. Â
I'm trying import 7 tables from each of 30 SQL2005 databases into a SQL2005 Consolidation database. I can simply create data flow tasks for each one but instead I would like loop through a list instead.
I've created a table to house the names of the databases from which I want to import the data. I've created SQL task to return the database names from the table as a "Full Result Set". I've assigned the result set to a user variable (type = Object) an named the result name 0
What I'd like to do is create a data flow task which connects to each of the databases and imports 7 specified tables from each database appending the table name with my database name in the result set.
I'm stuck on how I'd set the connection strings in my OLE DB Source in my Data Flow task. Any insight would be greatly appreciated.
If I have an XML without an XSD what is the best way to create and import data in SQL Server? I know I can use xsd.exe to create an XSD from my XML.
But if I want my structure to be somewhat different in SQL server how would I go about creating a reliable and repeatable import system for my data so i can easily manage the data updates?
I have a report in reporting services which has use many datasets. Those datasets retrieve data from a same table.
Each Dataset use a store procedure.
In the first store procedure (associated to the first dataset), i call an another store procedure which fill the table.
My problem is that datasets haven't datas retrieved in the order of their position. So the third (for exemple) can begin retrieve data while the first store proc (called in the first dataset) is still running. I had logging start/finish time of each SP and it appears that Dataset are retrieved in an asynchronous way.
Does anyone face the same problème. Is there a solution to execute an store procedure before retrieving data ?
Help - I need to import data into an existing table. Most import rows were unique, so I had no problem using DTS and appending. However, some import rows match existing rows except for one column/field that contains updated/new data, and I have to either replace the entire row with the imported row, or replace the individual field with the new data. How do I do that when there are many rows to import? It would take forever typing in all the data using UPDATE. Thanks in advance for your help!