I've got a database with information on servers and applications. I also have an Excel file which has some of that information saved in it .
What I'm trying to do is compare the database with the Excel file and output all the results which are present in the DB and not the Excel file, and vice versa.
After some thinking, I decided that it might be best to create temporary tables and save all the data from the Excel file into them, and then do an outer join between the corresponding tables (I'm using SQL Server).
How do I go about doing this without creating models in Rails for them (unless I specifically have to create them)?
Not sure how to use raw SQL in this instance =s
You actually have several choices on how to import the Excel data. If you're looking for a strictly SQL Server solution then you can use a linked server or distributed queries. You can also use DTS/SSIS (depending on your version of SQL Server) for a solution that's external. You could call the SSIS or DTS packages from your own code. Excel also has an OLE DB provider, so if your application uses ADO or otherwise uses OLE DB then you can use that.
All of these methods are explained in a little more detail on Microsoft's website, including some sample code for some of them.
Related
I am trying to use Excel pull data from a large Oracle Data Warehouse via an ODBC connection. I have a query that works using the editor in Access. I've tried using Power Query and Microsoft SQL to use this query to get this data into Excel and I get errors.
Therefore:
Does SQL executed from Excel need to be in a different syntax? Shouldn't it still be Oracle?
How can I use this pre-written query to ping the data warehouse and get what I need?
Here is the SQL that I have so far. I had to change some table names...sorry if that makes it weird.
The SQL you posted uses Access-specific functions. That is NOT a valid SQL query if run directly against Oracle. If you have a bunch of linked tables in Access, that would allow this.
The ODBC datasource connection in Excel works differently. ODBC executes the query directly at the datasource. It does some validation first and supports a limited subset of SQL language supported at the destination. What's included in the subset is determined in part by the driver selected for the connection.
So what you want to do is use a tool that lets you build the query directly in an Oracle environment, like Quest Toad or Oracle SQL Developer. Once you have the query working there, it should be easier to port it to Excel.
One thing I like to do is put my query into a view on the database. Then I can just select everything from the view when creating the Excel connection.
It's also worth pointing you to the My Data Sources folder. When you first setup an ODBC connection in Excel, the connection is saved by default in Windows in a folder called "My Data Sources" located just under your user profile folder. For example: C:\Users\UserName\My Data Sources\Data Source Name.odc.
You can open these *.odc files in any text editor, and you should be able to manually edit the SQL here. Especially look for the <odc:CommandText> element. In this way you can build a simple query up front, and then improve on the SQL command in your favorite environment and easily move the updated SQL to the existing ODBC connection.
I would like to move all the rows inside a couple of tables from one SQL Server database into another SQL Server located in a different remote server. This means I cannot connect to both at the same time, so the exchange should have to be done via file or a similar procedure. The tables have identical column definition, meaning it is only the data inside what differs. Also important to note, I do not expect a full overwrite, but rather a merge into the second database.
You can use SQL Management Studios export/import tool. It can extract data in CSV file, so you can save it on a disk, after that change connection to the new server and run import with exported file. This should do a trick.
Here is a nice and quick tutorial:
https://www.youtube.com/watch?v=Vf6pluv0Lv4
Could you create a linked server?
http://msdn.microsoft.com/en-us/library/ff772782.aspx
use SSIS it will be good it can be automated as well as you can change your configurations also . tomorrow if you got different server you just have to change connection strings and if it is a daily task use SSIS .
I have two *.mdf databases and trying to copy the ASP.NET membership tables from one to the other.
I have tried the data\schema compare tool which I am either not using correctly or it won't find anything to add\update for some reason.
Publish to provider created an sql file with the data and schema. Don't know how I can use it from within VS to pull some tables I need and add to another existing database.
Is there a console or something I can launch a query from for SQL Server Express to copy tables from one of the db's in its DATA directory to another ?
Update: Just used the import/export data wizard. It finally copied all my tables without error but for some reason did not retain the relationship data/foreign keys. The tables that I copied over to the other database did not exist on the database, so no type conflict could arise but it still didn't copy the diagram and relationships.
Is it require to Copy in real time?..i had made code that copy Data from Sqlserver to MySql but it's real time and if you want to copy data not in real time then You Have to Use Migration toolkit.
I need to import to Access a .sql database backup file created with MySql .
Is there a way to perform this operation?
You can't restore a MySQL backup into any other database system.
If you want to import the MySQL data into Access, you could export it all into CSV files and import those to Access. You will still need to recreate relationships, defaults, indexes (?) and other data.
You can import SQL Server data into a new Access table. In general, importing is a way to convert data from a different format and copy it into Access. The source table or file is not altered in this process. You can import directly from a SQL Server database using an ODBC connection, a text file exported from SQL Server, or an XML file exported from SQL Server.
To make frequent import operations more convenient, you can automate them by creating a macro or creating a Microsoft Visual Basic for Applications (VBA) procedure. This is useful, for example, when you import data on a regular schedule or you have unusual or complex requirements for importing data.
if you use SQL Server Management studio then you can open the .SQL files and it will give you help in figuring out what syntax works in SQL -- and which doesn't.
For example, if you have a table name that is mis-spelled, SQL Server Management Studio will give you red squigglies under that table name.
I don't see that functionality in Access, and I don't think that it's coming any time soon. Access (Jet) hasn't gotten any new features in almost fifteen years.
I've just designed a large database by playing around in MS Access. Now that I'm happy with the design, I need to be able to generate this same database (tables, relationships, etc.) from code.
Rather than hand-writing the SQL CREATE statements (which will be long, tedious, and error-prone process), I was wondering whether there was a shortcut. I seem to recall from my limited exposure to MySql that I was able to export an entire database as an SQL statement that can then be run in order to regenerate that database.
Do you know of a way to do this in MS Access, either through the GUI, or programmatically?
I just found and tried out this tool: jet-tool. It seems to work well for Access 2010.
For free for 30 days (then $30) you can give DBWScript a go, looks like its what you are asking for, although not in native Access GUI or programmatically
The quick and dirty, easy, perfectly legitimate way to do this is just copy the .mdb file. Empty out the data if you need to - usually there are static tables that are handy to leave populated, however.
I use a free utility called MDB Viewer Plus (http://www.alexnolan.net/software/mdb_viewer_plus.htm).
Launch it, open your db, then select your table.
On top menu, select "Table > Generate SQL - CREATE".
I don't know what tools you have on your development machine, so this may or may not be helpful.
You can easily transfer your Access database to Microsoft SQL Server using the Upsizing Wizard.
The express edition of SQL Server is available for free > here.
You will also want to get the free Management Studio Express.
Using these free graphical-based tools you can easily generate the SQL statements to re-create the database. You will have the Create statements you are looking for and they will be placed in a text file.
The Bullzip is very good to this. Very simple. See bullzip Access to MySQL for example
It is possible export any tables to SQL or migrate automatically.
Access to MySQL is a small program that will convert Microsoft Access Databases to MySQL.
Wizard interface.
Transfer data directly from one server to another.
Create a dump file.
Select tables to transfer.
Select fields to transfer.
Transfer password protected databases.
Supports both shared security and user-level security.
Optional transfer of indexes.
Optional transfer of records.
Optional transfer of default values in field definitions.
Identifies and transfers auto number field types.
Command line interface.
Easy install, uninstall and upgrade.
The thing that you're mentioning in MySQL is sql dumping. Very useful feature. If you want to migrate the database to mysql, here's a helpful article.
http://www.kitebird.com/articles/access-migrate.html#TOC_4
I have been using for years a tool called database.net from https://fishcodelib.com/Database.htm
I generally use it on client's site as a portable version of SSMS (drop and run), but it can handle a multitude of RDBMSes, including Access.
Connect to your mdb/accdb, right click any table, choose SCRIPT AS, Create, and you're done.
If you right click Tables header, you can select multiple tables to generate, but I think it's a feature of the paid version.
I have no acquaintance with them, just a happy client.
I found an easy way to go:
Export-> ODBC Database
and then retrieve the SQL form there (e.g via pgadmin on postgres)
Compare'Em
http://home.gci.net/~mike-noel/CompareEM-LITE/CompareEM.htm
The free version creates VBA while the $10 pro version gives you DDL statements.