Convert MS Access 2010 query to SQLite query - sql

I have a query in MS Access database. I want to run this query in SQLite database. I wondering whether there is a easy way to convert the code or just change step by step?

You have several options available for viewing the contents of a sqlite database and running queries against it. When building sqlite from source you can choose to build the shell utility.
If you want something more turnkey you can install a free tool such as Sqlite Manager for Firefox or Sqlite Browser.
In both apps you can copy-and-paste your SQL that you want to execute against a SQLITE database file. Good luck!

Related

Run SQL queries without external database

I have a text file of tab separated data. Millions of rows so I can't open it in Excel.
Is there a way to use some SQL client to load the file and run queries on it without uploading the file to a database? I.e. can my local machine function as my database?
I know I could solve this with command line scripting but I'm trying to find a solution that I can then share with the accounting department and they're scared of the command line.
You can create an ODBC datasource based on the Microsoft Text Driver. That driver should come pre-installed on any Windows PC. This uses the Jet Engine which is still somewhere in the Windows OS. Then you can use any Query tool (even MS Query) to analyse your data.

SQL Server comparing mechanism

I have a creation script for a SQL Server database and beside it I have a test script
My test Script should compare the result of my original script and the database and let me know if it is a match
I need to store the resulting script in a repository.
I've already got a script and the database. It's not hard to write the test script, but I want an app that automates the process.
I've already got Redgate tools and I heard it can make the job for me, but how? If not, are there any other tools that could do such a thing?
If you're looking to compare the structure of the two databases this can be done using Redgate SQL Compare.
Set the location of your script as a "Scripts Folder" source within the tool.
Set the database where you have run the script as the target.
Run the comparison. This will show you if there are any differences.
Generate a report of the differences which can be referred back to at a later date. (https://documentation.red-gate.com/display/SC12/Generating+a+report)
To automate this process you can make use of the SQL Compare command line. (https://documentation.red-gate.com/display/SC12/Simple+examples+using+the+command+line)
Full disclosure: I'm a developer at Redgate for SQL Compare.
I'm not sure if you are searching something to compare your data or the structure of your databases.
If it's for the structure (like Red-Gate SQL Compare and not SQL Data Compare), you can install SSDT (Microsoft SQL Server Data tools - It's free and available for visual studio).
With SSDT you will be able to create a database project and compare 2 databases structures.
Here is a quick presentation that I found on youtube:
https://www.youtube.com/watch?v=FKSsbWnFMD8
You can completely automate comparison and reporting with Apex Diff. Not sure which SQL Server are you using, but it's free for SQL Server Express.
Here is a step by step tutorial, which you should follow with one difference - set Script folder as data source:
https://solutioncenter.apexsql.com/how-to-keep-a-source-control-repository-updated-with-the-latest-sql-server-database-changes/

Automatically Generate SQL from existing MS Access table

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.

What's a good tool to run SQL scripts against any database?

Currently I have a custom tool which generates vanilla-SQL (only using standard SQL), from our Data-models that sets up database schemas and initial data for our new databases, and do version patches, etc... This part is all fine and dandy right now.
However running these SQL scripts against all the different databases (different vendors) is a pain, so I wrote up a quick little Php script a while back that does it for me, but I was wondering if there is any better solution to this problem?
Thanks
I use SQL Developer, it's really cool.
It runs in any plataform (is a Java application), you could connect to any database vendor and it's free.
I use Squirrel, like SQL Developer it is a java application which is free.
Description
SQuirreL SQL Client is a graphical
Java program that will allow you to
view the structure of a JDBC compliant
database, browse the data in tables,
issue SQL commands.
Download and Installation

Importing data to MySQL from MS SQL

I want to import data from MS SQL Server, run it through some sort of regexp to filter out stuff, and import it into MySQL. I then, for each query, wish to display a relevant image from a third database. What would be the easiest way to do this, importing and linking wise?
Thank you.
Clarification: It is a php application to filter data from another database, and then for each record show an associated image from a 3rd database. It is from scratch...
You can try the MySQL Migration Toolkit.
http://dev.mysql.com/downloads/gui-tools/5.0.html
Now archived at http://downloads.mysql.com/archives.php?p=mysql-migration-toolkit
use SQL Management Studio (or Enterprise Manager depending on version) with the SQL Server import wizerd to get it into MS SQL.
From there you can export it to Mysql using the MySQL connector drivers.
As for as displaying an image from a third database, that is completely up to the code you have written in your application.
I would use the Microsoft SQL Server Data Publishing Wizard (free). You can use it to script your entire database (including insert statements.) You'll have to edit this script a little bit probably to get it to run in MySQL. Now you just have a regex problem. You can try:
Manipulating the data in MS SQL via a query, or from code (using regex) the transfer.
Running your regexes on the script file itself, maybe try some macros, find and replace, etc.
Manipulating the data in MySQL via a query, or from code (using regex) after the transfer.