using ADO.NET to select from multiple VFP tables - sql-server

I need to select from 2 VFP free tables on some different network locations.
I've managed to get both tables into a dataset as two DataTables and add a Relation for them.
Now I need to join them and the result to insert into a SQL server database.
Any ideas?

Use two different queries to load the required subset of rows and columns from each table, upload each table individually to temp SQL server tables (using SqlBulkUpload), and then run your query in SQL against the two temp tables to create the required table.

Use Microsoft Access to add them as linked tables. You can then read the data from .net as though it were native Access data. You might be able to create queries in Access that join the tables and then read the queries from .net too.

Related

Very slow queries in MS Access with joined MS SQL table via ODBC

What is the best solution when I would like to use an Access front-end application with some linked table (via ODBC) from MSSQL Server?
The difficulty of this for me is that I have to use complex queries with many multiple joins (and functions called from queries).
It is very-very slow because of the joins between the two DB (and there is a lot of data in some tables, the 2 GB Access mdb limit is the reason of the MSSQL DB upgrade).
Pass-through query doesn't help because of the joined Access tables.
With OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0'... it is still slow in SQL Server too. I tried ODBC linked view with WHERE clause from MSSQL, but it
seems as slow as the full table.
I have to move all of joined Access tables to the MSSQL DB and convert all queries to Pass-Through? Is there any other solution?
I have to move all of joined Access tables to the MSSQL DB
Yes, definitely.
and convert all queries to Pass-Through?
Not necessarily, only those that are still slow.
"Normal" INNER JOIN queries, using only linked tables from one server database, are handled by Access and the ODBC driver in a way that everything is processed on the server. They should be (more or less) as fast as when run on the server (or as Pass-Through query).
Only "complex" queries, especially involving multiple INNER and OUTER JOINs, won't work like that. You'll notice that they are still very slow when running on linked tables. These need to be changed to Pass-Through queries.
Edit: I just noticed
functions called from queries
You can't call VBA functions from PT queries, and they will again kill performance when called from Access queries running on linked MSSQL tables (because they have to be processed locally).
You'll need to learn to create views in MSSQL, probably also user defined functions and/or stored procedures.
In the long run, you'll find that views are actually easier to manage than PT queries.

Match entries between two different tables on two different servers record-by-record

I have two different databases located on two different servers.
One is SQL Server while the other is Netezza.
I wish to check if the entries on the SQL Server are identical to the entries on my Netezza. I wish to do this record by record.
I want the output to tell me which entries exist in SQL Server but DO NOT exist in Netezza.
I am trying to use Informatica PowerCenter to create a mapping, but I am stumped.
Use an Joiner transformation to join those tables. Select Netezza table as Master and SQL server table as Detail and select the join type as Detail Outer Join.
Now in the output from joiner, you will get all rows from SQL server, and only matching rows from Netezza table. If the record is not present in Netezza, Netezza fields will come as NULL. You can check only one Netezza key field in an expression transformation afterwards to determine if the records is present in Netezza.

Is there a way to automatically join many tables in SQL Server?

I just imported ~50 tables; each table has 2 common foreign keys (making each record unique). My goal is to setup a query that joins all these tables; I obviously don't want to have to this manually and was thinking about setting up a procedure that loops through all tables to dynamically build this query ... is this the best way or is there an obvious solution I'm not seeing? Thanks you
No there is not. You have to manually write the query to JOIN the tables.
You can also check Automatically Generate a Set of Join Filters Between Merge Articles (SQL Server Management Studio) but I am not sure if that is going to help.

Join two different types of databases together

I have two databases, one MSSQL and the other in Access.
Right now, inside the access file, the mssql tables are set up as linked tables so queries can be written using tables from both databases. (e.g. "select * db1.table1 where db1.table1.somevalue not in db2.table1", or select into tables like that one)
These queries need to be moved into a VB.NET project, but still be linked to the access file.
I think what I am needing is a Database object that can have tables from 2 different connections, (ie the SqlClient and OleDb connections)
Is this possible? If so, how? Or do I need to rewrite the queries using loops or something?
What I would do is query your access database to get some result set and that pass that result set as a parameter to a stored procedure in your MS SQL database. You would just have to transform your results from access into XML to be passed as a xml variable as a parameter. And then in your stored procedure you can convert the XML to be a table variable and you can use it just like a regular table.
THere is no reason you can't create an MS Access .mdb with Links to your MS Access Database and your SQL Server database
Access Db #1 Contains Access Tables and Data.
SQL Db Contains your MS SQL Tables.
Access Db #2 contains links to the tables in Access DB #1 as well as links to the tables in your SQL Server Db. This .mdb files ALSO contains your query defs required by your vb.net project.
I'm pretty sure you can just connect to the Access database. All the internal objects--including the links to SQL Server tables--should be accessible to your vb.net project.

Can I "join" across datasources in SSRS?

I've got two datasources, one Oracle and one Sql Server. Due to circumstances that predate me (as in it was like this when I found it) some columns in the Oracle database contain PKs from lookup tables in the Sql Server database.
I am attempting to create a Sql Server Reporting Services report that will combine data from both the Oracle and Sql Server database; where the data to be reported is partially from Oracle but some of the values needs to be looked up in Sql Server.
I've got the datasources. I've got the DataSets. I just can't figure out how to show both datasets in the same tabular report.
Is this possible? If so how so? I'd rather not resort to a db link in one or the other databases as I'd like to handle this on the reporting side.
I don't think you can join directly, but you might be able to add a subreport that would query the second datasource by using the foreign key from the first datasource as a parameter. See: How to: Add a Subreport and Parameters (Reporting Services).
You could also try using the Lookup and Lookupset functions within your tablix.
Lookup is a 1 to 1 join while Lookupset is 1 to many and may need you to have your data concatenated if you want a set of strings out.
For Lookup the following is from the MSDN site with some tweaks for my simple mind
Lookup(Field you are joining from, Field you are joining to, Field you want back, Dataset of the field you want back)
The tablix should be linked to the dataset of your source (joining from).
And just realised this is from 2010, not 2014...so a necro-post!
you could also embed a table inside another table and pass the primary key to the embeded table.
You could create a linked server that would contain data from both instances. From the SSRS point of view you would have one single datasource.
You can use heterogenous services or oracle transparent gateway to run the report off the oracle side. Oracle can query the data from the SQL side.

Resources